| |
| |
 |
|
| |
COBOL TUTORIAL
FOR BCA STUDENTS OF M G UNIVERSITY |
|
| |
|
|
| |
 |
|
| |
|
| |
|
| |
|
|
| |
Quite
often it is required to move some of the data items
of one group to some other data items in another group.
If the names of the corresponding data items of the
two groups are distinct, then for each data item,
a separate MOVE verb should be used. However, if the
corresponding data items of both the records have
identical names, then instead of using separate MOVE
statement, just one MOVE statement with the CORRESPONDING
option can be used.
It is not necessary that the corresponding data names
in the two records should appear in the same order.
The general format of the MOVE CORRESPONDING statement
is:
|
|
| |
 |
|
| |
where dentifier-1 and identifier-2 should be group
names.
Note that MOVE CORRESPONDING is not a group move,
it is merely a means for specifying a number of elementary
moves through a single MOVE statement. Source and
destination groups can include data names that are
not common. Only those fields having identical names
in the two records will take part in the data movement.
The remaining data items in the destination group
will remain unchanged.
Example:
|
|
| |
|
|
| |
The data stored in the four fields of PAY_REC should
be moved to those fields of PRINT_REC that are given
the same data names.
The following four MOVE statements can serve the purpose.
MOVE ID-NUMBER OF PAY-REC TO ID-NUMBER OF
PRINT-REC.
MOVE NAME OF PAY-REC TO NAME OF PRINT-REC.
MOVE DEPARTMENT OF PAY-REC T0 DEPARTMENT OF PRINT-REC.
MOVE BASIC-PAY OF PAY-REC TO BASIC-PAY OF PRINT-REC.
However, since both the records have same names for
the concerned data items, the following statement
MOVE CORRESPODING PAY-REC TO PRINT-REC.
will have the same effect.
|
|
| |
|
| |
 |
|
| |
|
|
| |
 |
|
| |
|
|
|
|