View previous topic :: View next topic
|
Author |
Message |
anky.1987
New User
Joined: 09 Sep 2010 Posts: 2 Location: Chennai
|
|
|
|
Hi All,
I have a similar req, so thought to post it here itself. I have a PS which has amount field s9(6)v9(2) in below format
Code: |
0000400}
0000375G
0000375P
|
0000375G means 000037.57
I need to sum up those and use that in trailer record. I have tried to use below sysin:
Code: |
SORT FIELDS=(1,1,CH,A)
INREC BUILD=(45:21,08,SFF,TO=ZD,LENGTH=08)
SUM FIELDS=(45,8,ZD) |
say the field starts at position 21. This is giving wrong data and not in input format. |
|
Back to top |
|
|
anky.1987
New User
Joined: 09 Sep 2010 Posts: 2 Location: Chennai
|
|
|
|
I just had it correct using below:
SORT FIELDS=(1,1,CH,A)
INREC BUILD=(45:21,08)
SUM FIELDS=(45,8,ZD) |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
anky.1987
Your input is already a zoned decimal number with sign overpunch. Why are you treating it as an Signed Free format and then converting it to ZD? By doing so you are actually loosing the sign. The over punch in hex format looks like this
Code: |
{ABCDEFGHI}JKLMNOPQR
01234567890123456789
|
Hex C0 thru C9 are positive numbers and D0 thru D9 are negative numbers. The number on top represents the sign overpunch and the lower number represents the readable decimal number
so change your control cards to the following
Code: |
//SYSIN DD *
OPTION ZDPRINT
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(21,8,ZD)
//* |
Check this link which explains ZDPRINT effect on SUM statement |
|
Back to top |
|
|
|