Page 1 of 1

Re: JCL SORT

PostPosted: Sun Jan 08, 2012 1:39 pm
by prebs87
I have a input file as below;
the input file is sorted based on the first two bytes.
01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy

By using sort utility in jcl i want the output file as below: the output files should be sorted based on the 9 digit values i.e
111111111
222222222
333333333

01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy

Re: JCL SORT

PostPosted: Sun Jan 08, 2012 1:52 pm
by BillyBoyo
You mean the the sort key you want to use is in different places or different records?

Assuming so, have a look at this one: dfsort-icetool-icegener/topic6889.html

Re: JCL SORT

PostPosted: Sun Jan 08, 2012 6:53 pm
by NicC
Sorry, but JCL does not sort data. It WILL tell the operating system which sort program you want to run and your question should be posted in the relevant sort section of the forum.

Re: JCL SORT

PostPosted: Mon Jan 09, 2012 2:10 am
by dick scherrer
Hello and welcome to the forum,

The duplication of your post has been removed (it was a complete repeat and not needed).

In addition to showing the input and output you want you need to explain how to know where the key is in each record. You knew to group the One's, and the Two's and so forth. How is the code to know this - what is the rule for each record type?

Also, mention your recfm and lrecl.

Re: JCL SORT

PostPosted: Tue Jan 10, 2012 1:16 am
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, and that the key starts in position 27 for the '01' records, in position 4 for the '40' records and in position 3 for any other records. Adjust as needed.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
01111111111aaaaaaaaaaaaaaaaaaaaaaaaaa
01222222222aaaaaaaaaaaaaaaaaaaaaaaaaa
01333333333aaaaaaaaaaaaaaaaaaaaaaaaaa
02bbbbbbbbbbbbbbbbbbbbbbbb111111111vv
02bbbbbbbbbbbbbbbbbbbbbbbb222222222vv
02bbbbbbbbbbbbbbbbbbbbbbbb333333333vv
400111111111yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400222222222yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
400333333333yyyyyyyyyyyyyyyyyyyyyyyyyyyyy
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'02'),OVERLAY=(81:27,9)),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'40'),OVERLAY=(81:4,9)),
        IFTHEN=(WHEN=NONE,OVERLAY=(81:3,9))
  SORT FIELDS=(81,9,ZD,A,1,2,CH,A)
  OUTREC BUILD=(1,80)
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080