COBOL Group Move
Group MOVE used to move one group item to another group of similar kind.
Group MOVE also similar to simple MOVE, but used for group variables.
In Group MOVE, sending field & Receiving field must be a group variable.
Sending group field must be one.
Receiving group fields must be a variable.
Receiving group fields might be one or more.
In group MOVE, the sending and receiving group field lengths may not be same.
In group MOVE, sending field length is less than the receiving field the remaining length of the receiving field will be filled with ZEROES or SPACES based on the data type declaration.
In group MOVE, the sending field length is greater than the receiving field the data will be moved to receiving data field based on the data type.
During group MOVE, if the sending data item has numeric then the receiving data item should be numeric and alphanumeric in the particular positions.
During group MOVE, if the sending data item has alphabetic/alpha-numeric then the receiving data item should be alphabetic/alpha-numeric in the particular positions.
MOVE sending-group-field TO receiving-group-field.
In the above example, VAR-GRP-1 declared as of length 22 and initialized with 01MAINFRAMESTECHHELP.
Similarly VAR-GRP-2 is declared with same length 22.
VAR-GRP-2 has equal length with VAR-GRP-1, after executing the below group MOVE the VAR-GRP-1 data will be moved to VAR-GRP-2.
MOVE VAR-GRP-1 TO VAR-GRP-2.
COBOL Simple Move COBOL Move Corresponding