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

moving a variable to a host variable


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunswap

New User


Joined: 23 Mar 2006
Posts: 13

PostPosted: Wed Sep 20, 2006 9:23 am
Reply with quote

I have a variable with picture clause of X(4).
I want it to be moved to a host variable with picture clause of pic s9(9) comp.

is it possible
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Sep 20, 2006 12:58 pm
Reply with quote

The easiest way is to define the variable as a group field:
Instead of:
Code:
03  MY-VAR  PIC X(4).

Define:
Code:
03  MY-VAR.
    05  MY-VAR-9 PIC 9(4).

Like this, MY-VAR stays the same (alpha field, length 4), and you can use MY-VAR-9 to move it to any comp or comp-3 field.
Don't forget to ask IF MY-VAR IS NUMERIC before!
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts access the last host command CLIST & REXX 2
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
Search our Forums:

Back to Top