Page 1 of 1

sorting using jcl

Posted: Thu Sep 22, 2011 3:39 pm
by bhargavi_ns
I have a few records in a dataset which is the result of a jcl run prior :

FILE1 9002 000000010
FILE2 9003 000000020
FILE3 9004 000000030
FILE4 9005 000000040
FILE5 9006 000000050
FILE6 9007 000000010

-------------------------------------------------------

I want JCL for the above data to be converted as below into a ds :

NAME SEQ NO OF REC
FILE1 9002 000000010
FILE2 9003 000000020
FILE3 9004 000000030
FILE4 9005 000000040
FILE5 9006 000000050
FILE6 9007 000000010
TOTAL REC 000000160


any advises ?

Posted: Thu Sep 22, 2011 9:49 pm
by Frank Yaeger
You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
FILE1    9002    000000010
FILE2    9003    000000020
FILE3    9004    000000030
FILE4    9005    000000040
FILE5    9006    000000050
FILE6    9007    000000010
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  OUTFIL REMOVECC,
    TRAILER1=('TOTAL REC',16:TOT=(18,8,ZD,M11,LENGTH=8))
/*
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

Posted: Fri Sep 23, 2011 2:36 pm
by bhargavi_ns
********************************* Top of Data **********************************
NAME OF THE FILE SEQ COUNT
FILE1 9002 000123449 ............................
FILE2 9003 000971349 ............................
FILE3 9004 000999949 ............................
FILE4 9005 000976543 ............................
FILE5 9006 000765989 ............................
FILE6 9007 000764533 ............................
TOTAL NO OF RECORDS 004601812
******************************** Bottom of Data ********************************

Thanks Franks.
but how can i eliminate those lines in the output ..


Note :
to get individual files , i have in the beginning used :


OUTREC FIELDS=(C'File1 ',26:18,6,36:12,4,44:35,9)

the above i have used 6 times to get 6 files and then IEBGENER into one DS. then with your help got the sum.

Please help me to improve on this , and eliminate those unwanted lines

Posted: Fri Sep 23, 2011 10:37 pm
by Frank Yaeger
but how can i eliminate those lines in the output ..
I don't know which lines you're talking about. I see a header and trailer record, but I don't know if those are in the original input file or not. And I don't know if you want them in the output file or not. Please clarify what exactly is in the original input file (or files) and what exactly you want in the output file.

Posted: Sat Sep 24, 2011 8:18 am
by bhargavi_ns
I receive 6 files daily . Each having around few records .
The trailer of each file has the seq number and record count in different position .
example :
in File 1 :
The Trailer record consists of :

FTAXENCRCM1898520110915093313001000084137560000

from this reocrd in file1 i have to extract and display like the format i have already specified :(the same for all 6 files)

NAME OF THE FILE SEQ COUNT
FILE1 9002 000123449
FILE2 9003 000971349
FILE3 9004 000999949
FILE4 9005 000976543
FILE5 9006 000765989
FILE6 9007 000764533
TOTAL NO OF RECORDS 004601812


can you give me a simple JCL to do the above .

i got to know how to calculate the total record count from your help.
but can you give me a simple JCL to extract all the 6 files as i have mentioned above.

Posted: Mon Sep 26, 2011 10:10 pm
by Frank Yaeger
The trailer of each file has the seq number and record count in different position .
example :
in File 1 :
This is too vague!

Show me an example of each of the 6 input files and what you expect for output.

Also, tell me the RECFM and LRECL of each input file.

I'm happy to help, but you have to give me the details I need.