Reference modification for the receiving field?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
BobP
Registered Member
Posts: 44
Joined: Mon Jun 17, 2013 1:33 pm

Reference modification for the receiving field?

Post by BobP »

Hi

is it possible to use reference modification for a receiving field in a COBOL program? For example, can we use something like this:

Code: Select all

MOVE 'ABC123' to WS-VAR-A(3:3). 
?
Thanks,
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Reference modification for the receiving field?

Post by Robert Sample »

What did the Enterprise COBOL Language Reference manual tell you when you searched it for reference modification?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Reference modification for the receiving field?

Post by nicc »

What happened when you simply tried it?
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Reference modification for the receiving field?

Post by Robert Sample »

My second observation (after suggesting you look at the manual) is that your MOVE statement is incorrectly set up -- you are moving a 6-byte constant into a 3-byte receiving field.

My third observation is that it took 3 minutes for me to code, compile, and execute a test that shows reference modification on receiving variables is perfectly valid. It took 2 more minutes to change my test to match your post and find that the results matched my expectations -- the ABC got moved since you told COBOL the receiving field was only 3 bytes, and alphanumeric data is moved left-to-right. So rather than waiting 10 1/2 hours for responses on a forum, you could have tested it yourself in far less time.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”