z/OS DFSORT Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Example 3

z/OS DFSORT Application Programming Guide
SC23-6878-00

  INREC BUILD=(20,4,12,3)
  SORT FIELDS=(1,4,D,5,3,D),FORMAT=CH
  OUTREC BUILD=(5X,1,4,H,19:1,2,5,3,DATE1(-),80X'FF')

This example illustrates how a fixed-length input data set can be sorted and reformatted for output. A more efficient sort is achieved by using INREC before sorting to reduce the input records as much as possible, and using OUTREC after sorting to add padding, the current date and repeated fields. The SORTIN LRECL is 80 bytes.

The reformatted input records are fixed-length, and have a record size of seven bytes (a significant reduction from the original size of 80 bytes). They look as follows:
Position
Contents
1-4
Input positions 20 through 23
5-7
Input positions 12 through 14

The SORT and OUTREC statements must refer to the fields of the reformatted input records.

The reformatted output records are fixed length with a record size of 113 bytes. SOLRF (the IBM-supplied default) is in effect, so unless the SORTOUT LRECL is specified or available, it will automatically be set to the reformatted record length of 113. The reformatted output records look as follows:
Position
Contents
1-5
EBCDIC blanks
6
Binary zero (for H alignment)
7-10
Input positions 20 through 23
11-18
EBCDIC blanks
19-20
Input positions 20 through 21
21-23
Input positions 12 through 14
24-33
The current date in the form C'yyyy-mm-dd'
34-113
Hexadecimal FF's

Thus, the use of INREC and OUTREC allows sorting of 7-byte records rather than 80-byte records, even though the output records are 113 bytes long.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014