View previous topic :: View next topic
|
Author |
Message |
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
Dear all,
I have a requirement in which i need to sum up all the records and output only one record showing the total sum.
The field in the input record to summed up is of Packed decimal type with 2 decimal places(length = 5).
The output file should contain the total value in PD, length = 7 with 4 decimal places.
Say for example, i have 100 records in the input file, each having value 1.11 (in PD format). The field in the input record to be summed up is 10,5
My output record should contain the value 110.0000(in PD format)
Note: My shop has only SYNCSORT.
Please let me know if you need any other information.
Regards,
Ursvmg |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
My output record should contain the value 110.0000(in PD format)
|
It can't. . . 110.0000 is not a valid PD value. Leading zeros cannot be suppressed in a packed-decimal field - there will be leading zeros. There can be no decimal-point in a PD field.
Quote: |
Please let me know if you need any other information. |
Yes, we need to know what you really want. |
|
Back to top |
|
|
ursvmg
New User
Joined: 24 May 2007 Posts: 52 Location: Chennai
|
|
|
|
Dear d.sch,
Yeah I understand that there will be leading zeroes and no decimal as such in a PD field.
Here I'm (I hope) simplifying my question....
I need to convert a PD field like
00000770
0000010C
(Value displayed using layout mapped to FIXED DEC(9,2)) = 717.00)
to
000007700
00000100C
(Value displayed using layout mapped to FIXED DEC(13,4)) = 717.0000)
Regards,
Ursvmg |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might multiply the PD value by 100 and then use the proper mask to show the "output" as you want it. |
|
Back to top |
|
|
|