View previous topic :: View next topic
Author
Message
kumarmca1 New User Joined: 06 Jul 2009Posts: 13 Location: chennai
Hi,
I want to add two records from the input file and write the sum (5 bytes interval) in the output file.
Ex:
000923456007789022222
000934567009870123456
My requirement is to sum the records
0009 - Record type leave as it is
23456+34567
0077890+0098701
22222+123456
My output should be
ie 0009580230176591
i heard about icetool. But i am not very much expertise on this. Could you please help me how to do this.
Note:
There will be no other record in the input file. Only two records.
Thanks for your help,
Muthu
Back to top
venkatesh83be New User Joined: 10 Aug 2009Posts: 12 Location: Chennai
Hi Kumar,
Explain your requirement clearly -
I guess the 3rd sum value should be 22222 + 23456 - check that
Does 3rd sum value need not be written to output file ?
Thanks,
Venkat
Back to top
genesis786 Active User Joined: 28 Sep 2005Posts: 210 Location: St Katherine's Dock London
you can try sort also...
Code:
//S1 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD *
000923456007789022222
000934567009870123456
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,04,ZD,A)
SUM FIELDS=(5,5,ZD,10,5,ZD,15,6,ZD)
/*
output
Code:
000958023017659145672
Back to top
kumarmca1 New User Joined: 06 Jul 2009Posts: 13 Location: chennai
Hi Genesis,
Thanks for your help. The above code worked fine. I got the expected result.
I also tried the different code using dfsort and got the same result. But your code is simple.
Here is the code i used
Code:
//STEP2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
D1 P1 M1 15 15 15
D1 P1 M1 14 14 14
//SORTOUT DD DSN=DPSDZMU.SORT.ICE1,DISP=(,CATLG),
// DCB=(LRECL=18,RECFM=FB),SPACE=(CYL,(1,2),RLSE)
//SYSIN DD *
SORT FIELDS=(1,3,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,1,
TRAILER3=(1,9,10:TOT=(10,2,SFF,EDIT=(TT)),
13:TOT=(13,2,SFF,EDIT=(TT)),16:TOT=(16,2,SFF,EDIT=(TT)),18:18,1))
/*
Again thanks for your help.
Cheers,
Muthu.
Back to top
kumarmca1 New User Joined: 06 Jul 2009Posts: 13 Location: chennai
venkatesh83be wrote:
Hi Kumar,
Explain your requirement clearly -
I guess the 3rd sum value should be 22222 + 23456 - check that
Does 3rd sum value need not be written to output file ?
Thanks,
Venkat
Hi Venkatesh,
Sorry i have missed the third value.. i need the third value too. and the value you told is correct.
Back to top
Please enable JavaScript!