View previous topic :: View next topic
|
Author |
Message |
arunswap
New User
Joined: 23 Mar 2006 Posts: 13
|
|
|
|
how to move pic s9(5) comp-3 to host variable pic s9(4) comp.[/b] |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
arunswap
The COMP and COMP-3 indicate how the value is stored in memory. The compiler takes care of the conversion from one form to the other.
01 VAR1 PIC S9(5) COMP-3.
01 VAR2 PIC S9(4) COMP.
MOVE VAR1 To VAR2.
Your concern here should be the size of the fields. If the value in VAR1 is less than -32768 or greater than 32767 the result will be incorrect because of truncation and switching of the sign.
Dave |
|
Back to top |
|
|
raghunathns
Active User
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
i think it moves right four digits only.. no problem with sighn..
.. if you have 5 digit number then you miss the highest digit. i.e left side digit because right justified. |
|
Back to top |
|
|
|