But my requirement is slightly different. I want the total on all the records. my file contains Account number in first 11 bytes.The account
number can be duplicates. I want the account number total to be present on all records. My file has lrecl of 425 and the count should be in 421 byte for 5 bytes
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Sun May 02, 2004 9:57 pm Post subject:
Murali,
This is a little bit tricky as you want the count on all the records. I am aware that DFSORT'S splice operator can be used to get the desired results. My shop does not have DFSORT , so I solved it using sort/file-aid combination , easytrieve.
A brief explanation of the job. We first add a constant of '00001' at the end of every account number using INREC. then we sort on the account number and sum on the constant this will get unique records with the total count at the end.
Now we generate file-aid replace cards to copy the total for all records. I used file-aid as it allows 999999 entries for control cards. However you need to fiddle with the region size to make it to work.the control cards generated will look as follows:
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon May 03, 2004 10:26 am Post subject:
Here's a DFSORT/ICETOOL solution. You'll need R14 PTF UQ90053 (Feb, 2003) to use SPLICE. For complete information on the SPLICE operator of DFSORT's ICETOOL, see:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
// DD DSN=*.IN,VOL=REF=*.IN,DISP=(OLD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
* Get count for each set of duplicates
SORT FROM(IN) USING(CTL1)
* Add count to records
SPLICE FROM(CON) TO(OUT) ON(1,11,CH) WITHALL WITH(1,420)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,11,CH,A)
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
SECTIONS=(1,11,
TRAILER3=(1,11,421:COUNT=(M11,LENGTH=5)))
/*
_________________ 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