Example: A personnel roster is to be divided into sections by Department. (the figure Figure 1 presents the layout for the input record.)
To sort the records and generate a list that is divided by Department, the following is coded.
A sample of the listing generated is shown in the following figure.
Explanation: After the records are sorted alphabetically by Department (15,5) and Employee Name (1,14), they are divided into sections by department. That is, every time there is a change in the Department field (15,5 in the input record) the printer skips 5 lines (5L) before printing the next record. (Note, in the Sample Output above, the five-line break that occurs between ACCTG and PRSNL.) The OUTREC parameter is used to reposition the record fields and to leave blanks between them.