Hi,
I have a requirement where I need to build a sort card dynamically for group of records. I have coded the below to build the
sort conditions dynamically, it works fine but I am unable to do so for group of records.
Input is as below:
The group is identified when value changes in position (41,3) in input file
My job:
//SORT3 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SORTIN DD DSN=TTYA.EMANIP.MERCHANT.IN,DISP=SHR
//SORTOUT DD DSN=TTYA.EMANIP.MERCHANT.OUT,
// DISP=(OLD,CATLG,DELETE),RECFM=FB,
// LRECL=80,SPACE=(CYL,(30,20),RLSE)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,
HEADER1=('SORT FIELDS=COPY ',/,
'OUTREC IFTHEN=(WHEN=(1,1,BI,NE,1,1,BI),BUILD=(1,80)),'),
BUILD=(C'IFTHEN=(WHEN=((111,40,SS,EQ,C''',1,40,C'''),AND,',/,
C'(111,40,SS,NE,C''',44,40,C''')),',/,
C'BUILD=(87,64,C''',1,43,C''')),',80:X),
TRAILER1=('IFTHEN=(WHEN=(1,1,BI,NE,1,1,BI),BUILD=(1,80))')
/*
Output.png shows how the sort card is built dynamically based on above code:
I want to group the conditions for the values in field (44,40) from input based on key in 41,3, as below:
Expected output:
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,1,BI,NE,1,1,BI),BUILD=(1,80)),
IFTHEN=(WHEN=((111,40,SS,EQ,C'MICROSOFT'),AND,
(111,40,SS,NE,C'XBOX'),AND,(111,40,SS,NE,C'PAYPAL'),AND,(111,40,SS,NE,C'GOOGLE'),AND,(111,40,SS,NE,C'CRV')),
Please help me build the sort card.
Build sort card dynamically for group of records
Moderators: Frank Yaeger, Moderator Group
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