Hi,
I have 3 i/p files having same header and tailer. My requirement is to copy all the three files to a single o/p with only one trailer and hearder.Pls find the below example.
File1
------
Hearder
01433435466
01213232322
04354574585
Trailer
File2
------
Header
47934739748
49574957498
57457495448
39473974938
Trailer
File3
------
Header
58458400098
34384738698
Trailer
o/p File
---------
Header
01433435466
01213232322
04354574585
47934739748
49574957498
57457495448
39473974938
58458400098
34384738698
Trailer
Can any one suggest me how to solve this using SORT. Thanks
Regards,
Srinivas.
SORT query
Moderators: Frank Yaeger, DikDude, Moderator Group
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Is there something unique about the header that identifies it (e.g. 'HDR' in positions 1-3) or is it just the first record of every file?
Is there something unique about the trailer that identifies it (e.g. 'TRL' in positions 1-3) or is it just the last record of every file?
Is the header and trailer in every file the same, so it doesn't matter which one you keep?
What is the RECFM and LRECL of each input file?
Is there something unique about the trailer that identifies it (e.g. 'TRL' in positions 1-3) or is it just the last record of every file?
Is the header and trailer in every file the same, so it doesn't matter which one you keep?
What is the RECFM and LRECL of each input 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
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Member
- Posts: 12
- Joined: Wed Nov 08, 2006 1:03 am
The easiest way by using Xsum if you have same header and trailer in all three file and content of all three files is not duplicate. You can avoid XSUM part and SORTXSUM file.
//STEP01 EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=AAA,DISP=SHR
// DD DSN=BBB,DISP=SHR
// DD DSN=BBB,DISP=SHR
//SORTOUT DD DSN=AAA.dup,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(2000,500),RLSE),
// DCB=(MODELDCB,RECFM=FB,LRECL=270,DSORG=PS)
//SORTXSUM DD DSN=,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(2000,500),RLSE),
//* UNIT=TAPEA,EXPDT=2005/365,
// DCB=(MODELDCB,RECFM=FB,LRECL=270,DSORG=PS)
//SYSIN DD *
SORT FIELDS=copy
SUM FIELDS=NONe,XSUM
END
//SYSOUT DD SYSOUT=*
//*
Hope this will help!
//STEP01 EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=AAA,DISP=SHR
// DD DSN=BBB,DISP=SHR
// DD DSN=BBB,DISP=SHR
//SORTOUT DD DSN=AAA.dup,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(2000,500),RLSE),
// DCB=(MODELDCB,RECFM=FB,LRECL=270,DSORG=PS)
//SORTXSUM DD DSN=,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(2000,500),RLSE),
//* UNIT=TAPEA,EXPDT=2005/365,
// DCB=(MODELDCB,RECFM=FB,LRECL=270,DSORG=PS)
//SYSIN DD *
SORT FIELDS=copy
SUM FIELDS=NONe,XSUM
END
//SYSOUT DD SYSOUT=*
//*
Hope this will help!
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
rahul,
Your "solution" makes no sense. SUM FIELDS=NONE is ignored with SORT FIELDS=COPY. You must use SORT or MERGE with a key in order for SUM FIELDS=NONE to eliminate records. The key determines the duplicates to be eliminated. If you sorted on positions 1-7 to try to keep only one Header and one Trailer, you would remove duplicate data records as well, and also sort Header and Trailer before the data records. Also, if all of the header and trailer records are not the same, you might get the wrong one. Additionally, XSUM has no relevance for this requirement.
The questions I asked are relevant to the solution.
In the future, please try your "solutions" to ensure they work before posting them.
Your "solution" makes no sense. SUM FIELDS=NONE is ignored with SORT FIELDS=COPY. You must use SORT or MERGE with a key in order for SUM FIELDS=NONE to eliminate records. The key determines the duplicates to be eliminated. If you sorted on positions 1-7 to try to keep only one Header and one Trailer, you would remove duplicate data records as well, and also sort Header and Trailer before the data records. Also, if all of the header and trailer records are not the same, you might get the wrong one. Additionally, XSUM has no relevance for this requirement.
The questions I asked are relevant to the solution.
In the future, please try your "solutions" to ensure they work before posting them.
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