View previous topic :: View next topic
|
Author |
Message |
gskn4u Currently Banned New User
Joined: 29 Feb 2008 Posts: 25 Location: hyderabad
|
|
|
|
Hi
Can anyone help me with the code to the following requirement:
I have a file with records
Code: |
01 00000000042530405676 000001582
01 00000000042531167809 000000288
01 00000000042531234567 000000612
01 00000000042532059754 000001542
01 00000000042532422901 000005862
01 00000000042545624158 000000262
01 00000000042546018693 000000820
01 00000000042546410809 000000375
01 00000000042546631832 000000309
01 00000000042546902789 000000254
01 00000000042547253674 000002197
01 00000000042547370386 000000468
01 00000000042549774188 000000309
01 00000000042549995047 000000891
01 00000000042549998377 000000605
|
and i need the total sum of the 3rd field only.
Thanks,
Santosh |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
The following DFSORT JCL will give you the desired results
Code: |
//STEP0300 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4--
01 00000000042530405676 000001582
01 00000000042531167809 000000288
01 00000000042531234567 000000612
01 00000000042532059754 000001542
01 00000000042532422901 000005862
01 00000000042545624158 000000262
01 00000000042546018693 000000820
01 00000000042546410809 000000375
01 00000000042546631832 000000309
01 00000000042546902789 000000254
01 00000000042547253674 000002197
01 00000000042547370386 000000468
01 00000000042549774188 000000309
01 00000000042549995047 000000891
01 00000000042549998377 000000605
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('TOTAL OF 3RD FIELD : ',
TOT=(27,09,ZD,M10,LENGTH=11))
//*
|
Hope this helps...
cheer |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use these DFSORT control statements:
Code: |
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(TOT=(27,9,ZD,TO=ZD,LENGTH=10))
|
The output for your example would be:
0000016376
Adjust as needed. |
|
Back to top |
|
|
|