IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is it possibe to move the data to comp variable


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ananthapradeep

New User


Joined: 24 May 2006
Posts: 1

PostPosted: Wed Nov 19, 2008 10:00 pm
Reply with quote

HI,

In cobol :

77 a pic 9(4) value '2456'

77 b pic 9(4) comp.


MOVE a to b

Is it possibe to move the data to comp variable?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Nov 19, 2008 10:16 pm
Reply with quote

1) These lines won't compile -- you cannot have PIC 9 value ' '. Either remove the quotes from the VALUE clause or make A PIC X instead.

2) I changed A PIC 9(4) to A PIC X(4) and compiled a test program. The MOVE works just fine. As long as the value is numeric, there's no problem with the MOVE.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 20, 2008 1:43 am
Reply with quote

If you change your code to the following:
Code:
77 a pic 9(4) value 2456.

77 b pic 9(4) comp.


MOVE a to b

Field b will contain:
Code:
09
98
The hex equiv of a decimal 2456.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top