| |
 |
|
| |
COBOL TUTORIAL
FOR BCA STUDENTS OF M G UNIVERSITY |
|
| |
|
|
| |
 |
|
| |
|
| |
|
| |
In COBOL, there is no specific feature for the sorting
of a table. However, its provides a sort verb that
can be used to SORT a sequential file. In addition
to the sort verb, the MERGE verb can be used to merge
several sorted files to create a new file containing
the records of these files in the sorting order.
|
|
| |
|
| |
 |
|
| |
The process of sequencing the records in some desired
manner is known as sorting. Sorting is done upon some
key data item in the record. When a sequential file
is to be sorted, its record reside on the file medium
and can be accessed to only serially. The simple sort
verb requires the naming of three files – the
unsorted input file, the sorted output file and the
work file. The format of the simple SORT verb is as
follows:
|
|
| |
|
| |
The work file is to be defined by a sort description
entry(SD entry).The format of SD
entry is as follows:
|
|
| |
|
| |
|
| |
|
| |
|
| |
 |
|
| |
Like sorting, the merging of files is frequently required
in various commercial application. It is possible
to merge two or more files with one MERGE statement.
The format of the simple MERGE verb is as follows:
|
|
| |
|
| |
The input files to be merged through the MERGE statement
are specified in the USING phrase. These files must
be sequential files and must be sorted on the merge
keys. The rules of the SORT statement in respect of
the ASCENDING/DECENDING KEY phrase are also applicable
in this case.
|
|
| |
|
|
| |
 |
|
| |
|
|
| |
 |
|
| |
|
|