Prasanthhere
Active User
Joined: 03 Aug 2005 Posts: 306
|
|
|
|
Hi,
I am having a file which has records in the following format
Code: |
12345-333
123450444
12345-444
12345-555
21345-333
213450444
|
Here the first five bytes can leave it as it is ,and from the 6 byte till 9 byte i have to add and produce the output as follows
Code: |
12345-888
213450111
|
-888 is(-333+444-444-555)
Could you please share your thoughts on this ?
Thanks |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
-888 and 0111 is a rather strange format. What do you do if the negative value has 4 digits? Assuming that the more usual -888 and b111 (b for blank) is ok, here's a DFSORT job that will do what you want:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
12345-333
123450444
12345-444
12345-555
21345-333
213450444
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,5,
TRAILER3=(1,5,TOT=(6,4,FS,TO=FS,LENGTH=4)))
/*
|
SORTOUT will have:
Code: |
12345-888
21345 111
|
|
|