Example: A data center has decided to reorder the positions of the data fields in masterfile records after sorting them. (The following figure gives the layout for the masterfile record.)
To sort the records alphabetically by product name and reposition the data fields, the following is coded:
The following figure shows the output record after OUTREC processing.
Explanation: After the records are sorted alphabetically by product name (7,15,CH), OUTREC processing moves the Product Code field (22,3) to the first byte of the record, the Product Name field (7,15) to the fourth byte, the Region field (1,2) to the nineteenth byte, the Month’s Sales field (25,4) to the twenty-first byte, and the Sales to Data field (3,4) to the twenty-fifth byte.