Page 1 of 1

Adding a new Sort workfile in z/OS COBOL sort program

PostPosted: Sat Jan 28, 2012 3:02 pm
by ikartik90
I'm a new mainframe developer and wish to create a sort program in COBOL. But unfortunately I don't have a clue of how to add a sorting workfile to the COBOL code in the environment division. Kindly help me find a solution to the same.

The example I tried to go through provided the sort workfile as:
 ENVIRONMENT DIVISION.
              SELECT WORKFILE ASSIGN TO WORK.TMP.


But in case of mainframe where does WORK.TMP reside? I mean we generally use a JCL to call files for input/output. But how can we call WORK.TMP if it is not to be called using a DD statement in the run-time JCL?

Re: Adding a new Sort workfile in z/OS COBOL sort program

PostPosted: Sat Jan 28, 2012 3:50 pm
by BillyBoyo
My advice is to code a stand-alone sort to have the files already in sequence for your Cobol program. Keep the sort process simple, keep the program simple.

I've never coded a Cobol file sort for any business purpose. I never intend to, unless for some obscure reason in a horrible existing program, it can't be avoided.

However, I expect the Cobol manuals and trial-and-error will get you there if you insist on continuing. Does your site use DFSORT? If so, see if you can use compiler option FASTSRT. If you use Syncsort, see if it has that available. Check your Sort manual as well, it should be covered.

Re: Adding a new Sort workfile in z/OS COBOL sort program

PostPosted: Sat Jan 28, 2012 4:51 pm
by ikartik90
I wish to create the COBOL sort program as my menter wants me to.
Secondly, the website I'm referring doesn't put up any kind of JCL code for it is based on stand-alone cobol programming.

Re: Adding a new Sort workfile in z/OS COBOL sort program

PostPosted: Sat Jan 28, 2012 7:31 pm
by BillyBoyo
Well, I searched this forum and found this: ibm-cobol/topic6774.html#p29737

That program, and the topic, may also give you a leg-up, along with the manuals and trial-and-error.