Dear Experts,
My requirement is to delete the trailer record from the Input file and keep all the records as it is.
The format of the Trailer record:
1000 rows selected.
12345 rows selected.
123456 rows selected.
for this requirement, I am able to remove the trailer record with the SORT card,
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT1,
INCLUDE=(1,80,SS,NE,C'ROWS SELECTED')
but In the worst case, If any of the actual records contains the string 'rows selected' then they are also getting removed in addition to the trailer record.
Is there any command to point the Trailer record / Last record while using this sort card.
To delete the Trailer REcord from the file
Moderators: Frank Yaeger, Moderator Group
To delete the Trailer REcord from the file
Kumar
If u can dream it, U can do it.
If u can dream it, U can do it.
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT1 DD DSN=... output file (FB/80)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT1,
OMIT=(81,8,PD,EQ,LASTREC),
BUILD=(1,80)
/*
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: 5
- Joined: Mon Dec 10, 2007 7:48 pm
Dear Frank,
I check the above jcl.Its great.
I am very curious to know the syntax.Can you please explain
I check the above jcl.Its great.
I am very curious to know the syntax.Can you please explain
Code: Select all
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)
/*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT1,
OMIT=(81,8,PD,EQ,LASTREC),
BUILD=(1,80)
/*
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
Code: Select all
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,PD)
Code: Select all
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
TRAILER1=('LASTREC,+',COUNT=(M11,LENGTH=8),80:X)
LASTREC,+dddddddd
where dddddddd is the count of the input records = the sequence number for the last record.
Code: Select all
OUTFIL FNAMES=SORTOUT1,
OMIT=(81,8,PD,EQ,LASTREC),
BUILD=(1,80)
The BUILD operand removes the sequence number.
Does that help?
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
- Frank Yaeger
- Moderator
- Posts: 812
- Joined: Sat Feb 18, 2006 5:45 am
- Location: San Jose, CA
- Contact:
You can remove the last record quite easily without worrying about the RECFM or LRECL using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008):
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/
Code: Select all
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DISP=... output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) INPUT REMOVE LAST
/*
www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/
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