Hi,
I have a requirement where in a single GDG, I have two versions which is of different record lengths and I need to sort this GDG bases and need to write to an output file with the minimum record length format.
For ex: I have a GDG and it has two versions in it.
The first version has a record length of 100 and the second version has a record length of 120. So, I need to sort these two versions and write to the output file with a record length of 100 where I should extract only 100 bytes of the second version.
I have to do this in a single step of SORT.
Could you please let me know how to do this in SORT.
Thanks,
Bhaskar
Two different record length files
Moderators: Frank Yaeger, Moderator Group
-
- Member
- Posts: 16
- Joined: Mon Jul 06, 2009 5:25 pm
-
- Member
- Posts: 16
- Joined: Mon Jul 06, 2009 5:25 pm
I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient. Even though it is a single step , it would actually require 3 passes of data to get the desired results. But using 2 steps it would be just 2 passes of data and this is much more efficient.bhaskar.naidu wrote:I have to do this in a single step of SORT.
Here are the different approaches
Code: Select all
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FB120 DD DSN=Your input FB120 file,DISP=SHR
//FB100 DD DSN=Your input FB100 file,DISP=SHR
//TEMPF DD DSN=&&TEMPF,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FB120) TO(TEMPF) USING(CTL1)
COPY FROM(FB100) TO(TEMPF)
SORT FROM(TEMPF) TO(OUT) USING(CTL2)
//CTL1CNTL DD *
OUTREC BUILD=(1,100)
//CTL2CNTL DD *
SORT FIELDS=(1,10,CH,A)
//*
2 step approach
Code: Select all
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&FB120,DISP=SHR
//SORTOUT DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,100)
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&&FB100,DISP=SHR
// DD DSN=&&T1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,10,CH,A),EQUALS
//*
-
- Member
- Posts: 16
- Joined: Mon Jul 06, 2009 5:25 pm
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Because they just don't understand the meaning of "how many passes of data are required" - for them, less number of lines in JCL, less the resources!skolusu wrote:I don't understand the fascination for doing everything in a single step which in this case can turn out to be quite inefficient.
Regards,
Anuj
Anuj
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page