How XSORT Works [ HP RPG/XL Utilities-Part 1 XSORT ] MPE/iX 5.0 Documentation
HP RPG/XL Utilities-Part 1 XSORT
How XSORT Works
XSORT follows a logical sequence in performing a sort. This sequence is
described below:
1. XSORT reads a record from the input file.
2. XSORT checks your specifications to make sure the record is one
you want to sort. You may not wish to sort all the records in the
file you have specified.
3. XSORT builds a work record containing sort control fields and data
fields. It also formats the data portion according to your
specifications. Work record formatting is important because it
controls the format of your output.
4. XSORT submits the work records to the SORT subsystem for sorting.
5. XSORT retrieves records from SORT after sorting is complete.
6. XSORT writes records into the output file, retaining or dropping
control fields, according to your specifications.
NOTE Control fields are input fields whose characteristics are used as a
basis for the comparisons required by the sort. Control fields are
discussed in detail in the section on Field Descriptions. (See
chapter 6.)
-------------------------------------------------------
| | | |
| Control field | Data | Control field |
| A | | B |
| | | |
-------------------------------------------------------
1 10 11 29 30 36
Suppose that you wanted to rearrange the input file above because a
proposed sort job requires the following changes:
a. Change the contents of positions 30 through 36 placed in positions 1
through 7 of the work record.
b. Change the contents of positions 1 through 10 of the input file
placed in positions 8 through 17 of the work file.
c. Change the contents of positions 11 through 29 of the input record
placed in positions 18 through 36 of the work record.
The following is an example of how XSORT builds your work record to
reflect your specifications:
-------------------------------------------------------
| | | |
| Control field | Control field | Data |
| | | |
-------------------------------------------------------
1 7 8 17 18 36
NOTE The control fields must precede the data fields in the work record.
They will be retained on output unless you wish to drop them.
Reasons for retaining or dropping control fields will be discussed
in the Header Specifications section.
MPE/iX 5.0 Documentation