View previous topic :: View next topic
|
Author |
Message |
Imthiyaz
New User
Joined: 24 Apr 2008 Posts: 2 Location: Saint Joseph
|
|
|
|
Hello,
Input file structure is :
1) first 23 characerts ( all are of type PIC X)
2) position 41 to 8 characters are packed decimal values of PIC S9(08) V9(06) COMP-3.
My requirement is to
1) sort the file on first 23 characters
2) SUM the packed decimal values ( starting position 41 to 8)
3) Unpacked the summarized value, to 9(08).9(3) . Please note that , I want to round down the decimal values from 6 decimals to 3. (i.e. from S9(08)V9(06) to 9(08).9(3)
The SORT card, that I have is doing all the above things, except rounding down 6 decimals to 3 decimals.
Please let us know, whether DFSORT can do summarize and round down the result , simultaneously.
Thank you. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Wouldn't outrecing the summed value into a truncated edit mask get you what you want?
What do you have so far? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Wouldn't outrecing the summed value into a truncated edit mask get you what you want? |
Actually, it won't. For example, if the PD value is:
X'012345678123456C'
EDIT=(TTTTTTTT.TTTTTT) would give you:
12345678.123456
The value if rounding down from 6 decimal places to 3 would be:
12345678.123
but EDIT=(TTTTTTTT.TTT) would give you:
45678123.456
because the digits are filled into the pattern from right to left (6 for the last T, then 5 for the next to last T, etc)
The correct way to do this is to divide by 1000, e.g.
41,8,PD,DIV,+1000,EDIT=(TTTTTTTT.TTT) |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Right, right justify vs left justify.........
Not thinking too clearly without the first cup of coffee....grin..... |
|
Back to top |
|
|
Imthiyaz
New User
Joined: 24 Apr 2008 Posts: 2 Location: Saint Joseph
|
|
|
|
Thanks for the help, Frank. |
|
Back to top |
|
|
|