View previous topic :: View next topic
|
Author |
Message |
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
Could any pls help me on the below issue.
I have to move value of 10220 to s9(04) binary field.
I read in the cobol book that s9(04) binary can accomodate nbrs range from -32000 to +32000.
But when tried to move 10220 in this field..Data is getting truncated and saving only 4 digits like 0220.
Is there any way to accomodate this requirement instead of increasing the size of the receIving field.
Please advice. |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
The compile TRUNC option is key to your question.
Our shop has a standard that says we have to use TRUNC(OPT). This standard was based on some performance benchmarks that showed that TRUNC(OPT) runs significantly faster than the others. I am a bit skeptical about this but no big deal I guess...
Using TRUNC(OPT), this is what we observe...
The MOVE statement can safely move the value 12345 into a PIC S9(4) COMP field. However, the COMPUTE statement will truncate any result back to 4 digits. Very weird. |
|
Back to top |
|
|
|