View previous topic :: View next topic
|
Author |
Message |
reachsenthilnathan
New User
Joined: 20 Nov 2005 Posts: 15
|
|
|
|
Hi all,
We have a requirement where we move a s9(09) usage comp variable to 9(10) variable.
The variable declaration are: LS-ITEM-SID PIC S9(09) USAGE COMP.
WS-NUMERIC-SID PIC 9(10) VALUE ZEROES.
The value in LS-ITEM-SID is -2147483507.
Then the following statement is executed:
MOVE LS-ITEM-SID TO WS-NUMERIC-SID
After this statement the value in WS-NUMERIC-SID is 147483507. (Please note that leftmost two is missed).
The same statement is working fine in our client mainframe, but when we run it in our own mainframe the leftmost digit is truncated.
Any idea why this happens?
Thanks in advance.
Senthil Nathan.R |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
I would say the difference is in the compilers. There are some compilers, or compiler versions that will strictly adhere to the picture edit. You have S9(9), a signed 9 digit number. You are trying to use a 10 digit signed number. This will, with some compilers, truncate the value to -147483507. Then when you move it to a 9(10), an unsigned 10 digit number, the result will be 147483507.
The compile I have will honor any number that will fix into a full word +- 2147483647. Even if the picture is defined as a s9(5) comp. |
|
Back to top |
|
|
jon_s_rice
Active User
Joined: 24 Mar 2005 Posts: 102 Location: Douglasville, GA USA
|
|
|
|
When you compile the program use the TRUNC(BIN) option. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Nathan,
What is the actual hex value in LS-ITEM-SID? |
|
Back to top |
|
|
|