MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Moving from COMP to Alphanumeric field

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Jul 05, 2005 3:38 am    Post subject: Moving from COMP to Alphanumeric field Reply with quote

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
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Jul 05, 2005 6:03 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Jul 06, 2005 7:46 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for the reply.
Back to top
View user's profile Send private message Send e-mail
lal
Beginner


Joined: 21 Oct 2003
Posts: 70
Topics: 25

PostPosted: Wed Jul 06, 2005 6:47 pm    Post subject: Reply with quote

Hi vkphani,
Slight correction in Kolusu's reply it should be S9(10) COMP.

Regards,
Lal
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group