Group MOVE / MOVE CORRESPONDING
Assigning Values to Group Data Items
The MOVE statement assigns values to group data items in COBOL. Different types of group items have specific movement rules.
National Group Items
You can move a national group item to another national group item. The compiler processes the move as though each national group item were an elementary item of category national.
Alphanumeric Group Items
You can move an alphanumeric group item to an alphanumeric group item or to a national group item. You can also move a national group item to an alphanumeric group item.
MOVE CORRESPONDING
The CORRESPONDING phrase enables selective movement of subordinate items with matching names between group items:
01 Group-X.
02 T-Code Pic X Value "A".
02 Month Pic 99 Value 04.
02 State Pic XX Value "CA".
02 Filler PIC X.
01 Group-N Group-Usage National.
02 State Pic NN.
02 Month Pic 99.
02 Filler Pic N.
02 Total Pic 999.
MOVE CORR Group-X TO Group-N
In this example, only matching elementary items transfer values. State and Month receive national representation conversions from their Group-X counterparts, while unchanged items like Total remain unaffected.
Key Behavior
In a MOVE CORRESPONDING statement, sending and receiving group items are treated as group items, not as elementary data items — group semantics apply. Filler items in receiving groups remain unchanged.