View previous topic :: View next topic
|
Author |
Message |
HONEY LANGUAGE Warnings : 2 New User
Joined: 27 Oct 2006 Posts: 17
|
|
|
|
Hi,
Can any1 update me on this.
I have a two declaration part..
DCL A FIXED BIN INIT(45065838);
DCL B PIC'999V99999';
The logic is :
B=A;
i'm getting this output : 838.00000
But my output should be "450.65838"
Thanks in advance,
Thenmozhi |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
A = 45065838 with no fraction, so rightmost 3 digits = 838, with no fractional part. B has room for only 3 digits to the left of the decpt, hence the code is truncating your source value on the left and giving you 838.00000, just as the PIC says.
Why are you moving a very large integer value into a field that takes a max value of 999.99999?
COBOL does this too - truncates on the left if the target field is too small. It is the programmer's resp to check for this. |
|
Back to top |
|
|
HONEY LANGUAGE Warnings : 2 New User
Joined: 27 Oct 2006 Posts: 17
|
|
|
|
Hi Phil,
Just like that i'm testing it and thanks for your reply.
Thanks,
Thenmozhi |
|
Back to top |
|
|
|