Hi Hari,
I hope the below logic will work fine for your requirement.
.Now I am at home ,So I could not be able to try and test with the actaul code.
1)First generate the sequence number for all the i/p records.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jul 26, 2005 1:21 pm Post subject:
Here's a DFSORT job that will do what you asked for. I assumed the input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's new OVERLAY and COUNT-n functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Add seqnum in 81-88
INREC OVERLAY=(81:SEQNUM,8,ZD)
* Create a DFSORT Symbol as follows:
* LAST-1,+n
* where n=count-1
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,OUTREC=(80X),
TRAILER1=('LAST-1,+',COUNT-1=(M11,LENGTH=8))
* Copy records with seqnum
OUTFIL FNAMES=T1
//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/80)
//SYSIN DD *
OPTION COPY
* Omit record with seqnum equal to LAST-1 value.
OMIT COND=(81,8,ZD,EQ,LAST-1)
* Remove seqnum.
OUTREC FIELDS=(1,80)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
To get this, I insert Sequence numbers in the input file starting at position 81. Note, the seqnum starts from ZERO. So, when I refer 81,8 in OUTFIL TRAILER1, it will have the value 00000004.
2. Now, I read the input file again using the dynamic sort card. But this time I start the seqnum from 1 instead of zero. So, the seqnum '4' pointed by the dynamic sort card will actually be LAST BUT 1 RECORD.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum