Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Is it possibe to move the data to comp variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Is it possibe to move the data to comp variable
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: 7936
Location: Bellevue, IA

PostPosted: Wed Nov 19, 2008 10:16 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us