Module 6: Procedure Division
Qualification of data names while using MOVE
- The data name(variable name) of elementary items of different group need not be unique
- If two elementary data items of different groupings contain same name then you can use ‘OF’ qualifier followed by group data item name to refer variable uniquely
- Syntax format for the qualification of data names as follows:-
data-name-1 OF data-name-2
- Example:-
- Let’s assume data declaration in DATA DIVISION is,
01 EMP-REC-1. 05 E1 PIC 999. 05 E2 PIC 999V9. 05 E3 PIC XXXXXX. 05 E4 PIC 999. 01 EMP-REC-2. 05 E1 PIC ZZZ. 05 D1 PIC 999.9. 05 E3 PIC XXXBXX. 05 D4 PIC ZZZ.
- Assume currently data in EMP-REC-1 and EMP-REC-2 is as follows
- After the execution of below statement,
MOVE E3 OF EMP-REC-1 TO E3 OF EMP-REC-2The content of E3 elementary item belonging to group item EMP-REC-1 will be moved to E3 elementary item of group item EMP-REC-2. Content of EMP-REC-1 and elementary items E1, D2,D4 of EMP-REC-2 will remain unchanged. Below table indicate the final value of EMP-REC-2:-
- Let’s assume data declaration in DATA DIVISION is,