Group MOVE Statement


  • It is used to move data between two groups whose elementary items are in the same order.
  • However, the elementary items in both groups should have the same names and data type.
  • It can have one or more receiving group items.

Syntax -

MOVE sending-group TO receiving-group

Rules -

  • The sending item can be a numeric, alphabetic, alphanumeric, literal, or figurative constant.
  • The receiving item should be a numeric, alphabetic, alphanumeric, but not a literal or a figurative constant.
  • The elementary variables in both groups should have the same name and in the same order, but the lengths may differ.

Practical Example -


Scenario - Moving data from one group to another group.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       ...
       WORKING-STORAGE SECTION.
       01 WS-GRP1.
          05 NUM        PIC 9(02) VALUE 1.
          05 NAME       PIC X(20) VALUE 'MAINFRAMESTECHHELP'.
       01 WS-GRP2.
          05 NUM        PIC 9(02).
          05 NAME       PIC X(20).
       ...
       PROCEDURE DIVISION.
           MOVE WS-GRP1     TO WS-GRP2.
           DISPLAY "WS-GRP1: " WS-GRP1.
           DISPLAY "WS-GRP2: " WS-GRP2.
           ...

Output -

WS-GRP1: 01MAINFRAMESTECHHELP 
WS-GRP2: 01MAINFRAMESTECHHELP