View previous topic :: View next topic |
Author |
Message |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Tue Jul 05, 2005 3:38 am Post subject: Moving from COMP to Alphanumeric field |
|
|
Hi,
I have a field (customer id) coming from the input file. This field is a 4 Binary field. The value present in this field is 1234567892.
I am moving this value to a variable with pic clause as X(10).
If I display the destination field, it is showing 23456789_.
Space is getting filled in the last bit.
How to avoid this...
Thanks in advance. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Jul 05, 2005 6:03 am Post subject: |
|
|
Vkphani,
Fyi.. A 4 byte comp field CANNOT hold the value(1234567892) you are trying to move unless you compile with TRUNC(BIN) compiler option.
You can define another numeric variable and move the contents from there.
ex:
Code: |
01 WS-COMP PIC S9(09) COMP.
01 WS-CHAR PIC X(10).
01 WS-NUM PIC 9(10).
MOVE 1234567892 TO WS-COMP
MOVE WS-COMP TO WS-NUM
MOVE WS-NUM TO WS-CHAR
|
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Wed Jul 06, 2005 7:46 am Post subject: |
|
|
Hi Kolusu,
Thanks for the reply. |
|
Back to top |
|
 |
lal Beginner
Joined: 21 Oct 2003 Posts: 70 Topics: 25
|
Posted: Wed Jul 06, 2005 6:47 pm Post subject: |
|
|
Hi vkphani,
Slight correction in Kolusu's reply it should be S9(10) COMP.
Regards,
Lal |
|
Back to top |
|
 |
|
|