Posted: Tue Oct 07, 2003 1:20 pm Post subject: Report Using ICETOOL ?
Hi ,
I have a requirement and need your help on this. Need to insert the total on geo and total on serial in between the record for only record type '13'. If the geo change and serial is same need to write a GEO TOTAL line. If Serial change needs to write both GEO TOTAL and SER TOTAL line as explained below.
File is sorted in Record identifier, Serial and Geo .
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Oct 07, 2003 8:19 pm Post subject:
Subra,
Here's a DFSORT/ICETOOL job that does what you asked for. Note that the dddddddd.dds format is not supported for totals so we have to convert it to FS format (sdddddddddd), do the totals and then format it back to dddddddd.dds for output.
<Note to Ed: It took me quite a while to work this out and I wrote the DFSORT manual>
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
X00001 111 00000500.00- 11
Y00001 111 00000500.00- 12
000001 111 00000500.00- 13
000001 111 00001500.00- 13
000001 112 00000500.00 13
000002 111 00000500.00- 13
/*
//T1112 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T13 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T14 DD DSN=&&T3,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1112,VOL=REF=*.T1112,DISP=(OLD,PASS)
// DD DSN=*.T13,VOL=REF=*.T13,DISP=(OLD,PASS)
// DD DSN=*.T14,VOL=REF=*.T14,DISP=(OLD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(CON) TO(OUT)
/*
//CTL1CNTL DD *
* Change dddddddd.dds to sdddddddddd (FS format) in
* input records so we can do totals.
INREC FIELDS=(1,11, Bytes before amount
12:23,1, Sign
13:12,8, Digits before decimal point
21:21,2, Digits after decimal point
24:24,57) Bytes after amount
****
OUTFIL FNAMES=T1112,
* Separate out '11' and '12' records.
INCLUDE=(25,2,CH,EQ,C'11',OR,25,2,CH,EQ,C'12'),
* Change sdddddddddd (FS format) back to dddddddd.dds
OUTREC=(1,11,
12:12,11,FS,EDIT=(TTTTTTTT.TTS),SIGNS=(,,,-),
24,57)
****
OUTFIL FNAMES=T13,REMOVECC,
* Separate out '13' records.
INCLUDE=(25,2,CH,EQ,C'13'),
* Change sdddddddddd (FS format) back to dddddddd.dds
OUTREC=(1,11,
12:12,11,FS,EDIT=(TTTTTTTT.TTS),SIGNS=(,,,-),
24,57),
* Get totals as dddddddd.dds
SECTIONS=(1,6,
TRAILER3=('Ser Total',
12:TOT=(12,11,FS,EDIT=(TTTTTTTT.TTS),SIGNS=(,,,-))),
8,3,
TRAILER3=('************************',/,
'Geo Total',
12:TOT=(12,11,FS,EDIT=(TTTTTTTT.TTS),SIGNS=(,,,-))))
****
OUTFIL FNAMES=T14,
* Separate out '14' records.
INCLUDE=(25,2,CH,EQ,C'14'),
* Change sdddddddddd (FS format) back to dddddddd.dds
OUTREC=(1,11,
12:12,11,FS,EDIT=(TTTTTTTT.TTS),SIGNS=(,,,-),
24,57)
/*
The output is:
Code:
X00001 111 00000500.00- 11
Y00001 111 00000500.00- 12
000001 111 00000500.00- 13
000001 111 00001500.00- 13
************************
Geo Total 00002000.00-
000001 112 00000500.00 13
************************
Geo Total 00000500.00
Ser Total 00001500.00-
000002 111 00000500.00- 13
************************
Geo Total 00000500.00-
Ser Total 00000500.00-
_________________ 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