input -
00header-record
01Sub-header-record
10d1
10d2
10d3
10d4
10d5
98Sub-trailer-record
99Trailer-record
need output as -
output1-
00header-record
01Sub-header-record
98Sub-trailer-record
99Trailer-record
output2-
10d1
10d2
10d3
10d4
10d5
Can we do this in one step in JCL ??
Need a 1step JCL to seperate header and detail records
Moderators: Frank Yaeger, DikDude, Moderator Group
-
- Member
- Posts: 18
- Joined: Wed Sep 21, 2011 9:47 am
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
-
- Member
- Posts: 18
- Joined: Wed Sep 21, 2011 9:47 am
-
- Active Member
- Posts: 732
- Joined: Thu May 24, 2012 4:07 am
Yes, good work. Seeing your data values, I'd just tweak it a little.
The SAVE will get "everything which is not on file 2 (the 10's) onto file 1. The "SS" can be replaced by CH for the situation where there is only one value.
I suggested the other way around, assuming that there was more than one detail record, and fewer than three header/trailer records. But, seeing what you have, this is clearer, and only requires amending if/when new types of detail records are created.
Code: Select all
//S1 EXEC PGM=SORT
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= input..
//SORTOF1 DD DSN= output1..
//SORTOF2 DD DSN= output2..
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=2,INCLUDE=(1,2,CH,EQ,C'10')
OUTFIL FILES=1,SAVE
/*
I suggested the other way around, assuming that there was more than one detail record, and fewer than three header/trailer records. But, seeing what you have, this is clearer, and only requires amending if/when new types of detail records are created.
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