View previous topic :: View next topic
|
Author |
Message |
kiran_65
New User
Joined: 01 Apr 2005 Posts: 46
|
|
|
|
Hi,
I have a file.
One of the feild in the file is having picture clause EMPLE_DED_AMT PIC '(7)9V99' and the value is 00000023J.
I am adding all the amounts of the feild. But while adding it is not subtracting while it is adding (means if the previous valueis 20.34 and adding t0 23J should give 18.03 where it is giving 22.65.)
The declaration of the adding feild to EMPLE_DED_AMT is EMPL_DEDUCT_TOTAL FIXED DECIMAL(13,2) INIT(0);
Note: I am seeing as INVALID in the file aid when trying to view the value.
Please help me in declaring the feilds.
Thanks,
Kiran |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Where's the sign? If your value is +2.30 and you add it to 20.34 you're not going to get 18.03. You need the value to be -2.30 for that arithmetic to work. |
|
Back to top |
|
|
kiran_65
New User
Joined: 01 Apr 2005 Posts: 46
|
|
|
|
Thanks for the reply. I am new to PL/I. So, can you please provide the declaration of how we can declare PIC '(7)9v99 and corresponding fixed binary or fixed decimal.
Thanks,
Kiran |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
It's been a while since I did any PL/I code but I believe an S in the PIC defines the sign. |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
kiran_65 wrote: |
Thanks for the reply. I am new to PL/I. So, can you please provide the declaration of how we can declare PIC '(7)9v99 and corresponding fixed binary or fixed decimal. |
Don't even think about a corresponding FIXED BIN, as these should never ever be used for anything other than integer values.
To make your PIC signed, it must be declared as
or
or
where '?' is one of the overpunch characters, which I've never used, aka RTFM. |
|
Back to top |
|
|
|