Hi,
I have 2 files, the first containing the header and trailer and the second file containing the detail records only.
My requirement is to add the header and trailer along with the detail file and also update the trailer count.
Can we achieve this in one step? Please help
Header :: 00000000000000020110825
Trailer :: 999999999999999000000000 where the last 9 digits are the rec count
The file with detail records is a VB file, LRECL=215
O/P file is expected to be having same attributes as the I/P file
Add header and trailer and update trailer with detail record
Moderators: Frank Yaeger, Moderator Group
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Probably, but I need more details to tell you how.
Can we identify the header record by the '0' in position 1 and the trailer record by the '9' in position 1 (assuming that the data records do not have a '0' or '9' in position 1?). If not, how can we identify the header and trailer record?
In the output file, do you want the header records, detail records from file1, detail records from file2 and updated trailer record, in that order? Or do you want something else (e.g. sorted detail records)?
What is the RECFM and LRECL of the file with the header and trailer records?The file with detail records is a VB file, LRECL=215
Can we identify the header record by the '0' in position 1 and the trailer record by the '9' in position 1 (assuming that the data records do not have a '0' or '9' in position 1?). If not, how can we identify the header and trailer record?
In the output file, do you want the header records, detail records from file1, detail records from file2 and updated trailer record, in that order? Or do you want something else (e.g. sorted detail records)?
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Hi Frank,
The RECFM and LRECL of the file with header and trailer will be same as the detail file i.e VB file, LRECL=215
I want the header from file1
detail from file 2 (It is already in sorted order, so no need to sort again)
And trailer from file1 and updated
The header record is identified by the '0' in position 1 and the trailer record by the '9' in position 1
The RECFM and LRECL of the file with header and trailer will be same as the detail file i.e VB file, LRECL=215
I want the header from file1
detail from file 2 (It is already in sorted order, so no need to sort again)
And trailer from file1 and updated
The header record is identified by the '0' in position 1 and the trailer record by the '9' in position 1
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Assuming you want the count of the detail records, not the count of the detail records + header + trailer, you can use a DFSORT job like the following:
Code: Select all
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1 (VB/215)
// DD DSN=.... input file2 (VB/215)
//SORTOUT DD DSN=... output file (VB/215)
//SYSIN DD *
INREC IFTHEN=(WHEN=(5,1,SS,EQ,C'09'),BUILD=(1,4,5,1,5)),
IFTHEN=(WHEN=NONE,BUILD=(1,4,C'1',5))
SORT FIELDS=(5,1,CH,A)
OUTREC BUILD=(1,4,6)
OUTFIL IFTRAIL=(HD=YES,TRLID=(5,1,CH,EQ,C'9'),
TRLUPD=(20:COUNT=(M11,LENGTH=9)))
/*
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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
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