View previous topic :: View next topic
Author
Message
squid_rocks New User Joined: 21 Mar 2005Posts: 15 Location: Pune, INDIA
I want to eleminate first and last record from input file and copy rest of the records to an output file.
I can only use SORT (DFSORT or SYNCSORT) and FILEAID.
Please advice.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=T1,OVERLAY=(101:SEQNUM,8,ZD)
OUTFIL FNAMES=S1,REMOVECC,NODETAIL,BUILD=(80X),
TRAILER1=('Lastrec,+',COUNT=(M11,LENGTH=8))
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//SORTOUT DD DSN=... output file (FB/100)
//SYSIN DD *
OPTION COPY
OMIT COND=(101,8,ZD,EQ,+1,OR,101,8,ZD,EQ,Lastrec)
OUTREC BUILD=(1,100)
/*
Back to top
twissi Active User Joined: 01 Aug 2005Posts: 105 Location: Somerset, NJ
Frank,
How do we capture the removed header record into another flat file?
Many thanks,
Twissi.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
If you want the data records in one file and the header record in another file, you can use this DFSORT job:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/100)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=T1,OVERLAY=(101:SEQNUM,8,ZD)
OUTFIL FNAMES=S1,REMOVECC,NODETAIL,BUILD=(80X),
TRAILER1=('Lastrec,+',COUNT=(M11,LENGTH=8))
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)
//OUT DD DSN=... output file (FB/100)
//HDR DD DSN=... header record file (FB/100)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT,
OMIT=(101,8,ZD,EQ,+1,OR,101,8,ZD,EQ,Lastrec),
BUILD=(1,100)
OUTFIL FNAMES=HDR,ENDREC=1,BUILD=(1,100)
/*
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
You can now do this more easily using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/100)
//OUT DD DSN=... output file (FB/100)
//HDR DD DSN=... header record file (FB/100)
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) REMOVE INPUT HEADER TRAILER -
DISCARD(HDR) USING(CTL1)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=OUT
OUTFIL FNAMES=HDR,ENDREC=1
/*
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
Use [URL] BBCode for External Links
Back to top
Please enable JavaScript!