Page 1 of 1

Guide on COBOL MOVE.

Posted: Fri Feb 17, 2023 7:29 pm
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?

Re: Guide on COBOL MOVE.

Posted: Fri Feb 17, 2023 7:55 pm
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.

Re: Guide on COBOL MOVE.

Posted: Wed Mar 08, 2023 3:41 pm
by CobolQuery
Thanks.

Could you guide what are the side effects of moving a 30-byte variable to an 8-byte variable.