sorting using jcl

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

sorting using jcl

Post by bhargavi_ns » Thu Sep 22, 2011 3:39 pm

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 ?

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Sep 22, 2011 9:49 pm

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

Post by bhargavi_ns » Fri Sep 23, 2011 2:36 pm

********************************* 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

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Sep 23, 2011 10:37 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

Post by bhargavi_ns » Sat Sep 24, 2011 8:18 am

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.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Mon Sep 26, 2011 10:10 pm

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.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others