Posted: Fri Oct 03, 2003 12:20 pm Post subject: Reverse the order of records
we have a GDG (may be unsorted) of 80 as LRECL and FB as the record format. We need to reverse the position of the records i.e. if the file has 5 records, the 5th record will come in the 1st position,4th in 2nd and so on. The sequence needs to be same as in the input but in a reverse order.
So if the input file has records such as :-
123456
234567
980001
345678
218976
The output file should look like :-
218976
345678
980001
234567
123456
Can we achieve this using DFSORT/ICETOOL. I know we can do this using REXX.
Thank you.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Oct 03, 2003 12:53 pm Post subject:
The following DFSORT/ICETOOL job will do what you want:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//T1 DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Add sequence numbers to end of record
OUTREC FIELDS=(1,80,81:SEQNUM,8,ZD)
/*
//CTL2CNTL DD *
* Sort descending on sequence number
* to get reverse order
SORT FIELDS=(81,8,ZD,D)
* Remove sequence numbers
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
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