Guide on COBOL MOVE.

This Forum is for the guests or the users who are not registered on this board. This part allows guests to post in.
CobolQuery

Guide on COBOL MOVE.

Post by CobolQuery »

Code: Select all

01 Temp1
     02 temp2 pic x(05)
     02 temp3.
           03 filler pic x(1)
           03 temp4 pic x(2)

01  Empno pic x(30)
Move empno to temp1
Suppose if i move 30 bytes data to temp1, temp2 has empno(1:5) , temp3 has empno (6:3) and temp4 has empno(7:2) . Is it correct?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Guide on COBOL MOVE.

Post by Robert Sample »

Yes, that is how COBOL MOVE statements work. Please note that it is NOT a good idea to move a 30-byte variable to an 8-byte variable since you can have unexpected side effects.
CobolQuery

Re: Guide on COBOL MOVE.

Post by CobolQuery »

Thanks.

Could you guide what are the side effects of moving a 30-byte variable to an 8-byte variable.
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 “You are a Guest.”