Posted: Mon Jan 31, 2005 3:52 am Post subject: Sort the Detailed Records and adjust the Trailer Record
I have an Input File of LRECL=53 with the following Records
The First Byte=
0 represents header Record
1 to
6 represents Detailed Records
9 Represents the Trailer record
I need to sort the Input File On (2,15) and (26,8) and remove the duplicate detailed records and adjust the Trailer Record count with the remaining bytes in the Trailer Record intact.There will be only one Header Record and one trailer Record.The trailer Record Count byte is from (2,9).
Is it possible to solve the problem using PGM=SORT in one step (one pass)
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Jan 31, 2005 11:46 am Post subject:
With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can do this in one pass using DFSORT's new IFTHEN clauses as follows:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
* Set temp. key in 54 from 1 as '0' for '0', '9' for '9'
* or '1' otherwise. This allows us to use the temp. key
* for SORT/SUM.
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'0',OR,1,1,CH,EQ,C'9'),
OVERLAY=(54:1,1)),
IFTHEN=(WHEN=NONE,OVERLAY=(54:C'1'))
* SORT on the temp. key and the other keys.
SORT FIELDS=(54,1,CH,A,2,15,CH,A,26,8,CH,A)
* SUM to eliminate duplicates.
SUM FIELDS=NONE
* Add a sequence number in 55-63 for each remaining record.
OUTREC OVERLAY=(55:SEQNUM,9,ZD)
* Replace the count in the trailer ('9') record with
* the sequence number from 55-63.
OUTFIL IFTHEN=(WHEN=(1,1,CH,EQ,C'9'),OVERLAY=(2:55,9)),
* Remove the temp. key and sequence number.
IFOUTLEN=53
/*
For complete details on all of the new DFSORT and ICETOOL functions available with this PTF, see:
If you don't have this PTF installed, ask your System Programmer to install it (it's free). _________________ 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