Page 1 of 2

Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 6:16 pm
by Liam_George
Hi, i am new to mainframe and need to write a JCL that will sort data ( i can do that part) and write the output to a sequential dataset(part i can't do)

below is my code so far, this can write the output to a partioned dataset but not to a sequential

//MYJCL2 JOB 1,NOTIFY=&SYSUID
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&SYSUID..LABS.JCL(AREACODE),DISP=SHR
//SORTOUT DD DSN=&SYSUID..CW.DATA1(AREACODE),DISP=SHR
SORT FIELDS=(5,17,CH,D)


any help will be much appreciated

Thank You

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 6:19 pm
by enrico-sorichetti
what prevents Yo to use
//SORTOUT DD DISP=(NEW,CATLG),DSN=...,
// ...
// ...


with all the dataset attribute of a PS dataset ???

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 6:51 pm
by Liam_George
Data1 (mentioned above ) is the PS dataset that i need to write to, will the like of code you have gave me work for this?

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 7:07 pm
by steve-myers
You are writing the SORTIN and SORTOUT DD statements so they are members of a PDS rather than sequential data sets, which is fine if slightly unusual. It will hurt the performance of the sort product a little, but I doubt you will notice. You just have to be certain the DCB attributes of the two data sets are similar as sort does not copy DCB attributes.

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 7:12 pm
by Liam_George
The SORTIN is coming from a PDS the SORTOUT needs to write to a PS. I am a beginner so i am sorry for being clueless

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 7:34 pm
by BillyBoyo
Just define a PS for the SORTOUT, as enrico has indicated. There will be no changes to the SORT control cards.

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 7:52 pm
by Liam_George
so......


//MYJCL1 JOB 1,NOTIFY=&SYSUID
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&SYSUID..LABS.JCL(AREACODE),DISP=SHR
//SORTOUT DD DISP=(NEW,CATLG),DSN=&SYSUID..CW(AREACODE)
SORT FIELDS=(5,17,CH,D)

should that work?

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 7:56 pm
by NicC
No - the parentheses indicate a PDS - pds.name(member). You want a PS file - phys.seq.file.name - and you will need to specify space, RECFM and LRECL

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 8:04 pm
by Liam_George
any chance you could write it out for me, this will help me understand it better in the future.

Re: Sort Utility in sequential data set

PostPosted: Mon Mar 10, 2014 8:16 pm
by Blackthorn
You will understand it better still if you code it yourself. Refer to the JCL manuals, or simply find some JCL at your shop that does this. You must have hundreds if not thousands of jobs that create sequential files. As has already been said, writing the output to a PDS member is fairly unusual.