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


Example 2

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

 INREC FIELDS=(1,35,2Z,36,45)
 MERGE FIELDS=(20,4,CH,D,10,3,CH,D),FILES=3
 SUM FIELDS=(36,4,BI,40,8,PD)
 RECORD TYPE=F,LENGTH=(80,,82)

This example illustrates how overflow of a summary field can be prevented when three fixed-length data sets are merged and reformatted for output. The input record size is 80 bytes. To illustrate the use of the RECORD statement, assume that SORTIN and SORTOUT are not present (that is, all input/output is handled by user exits).

The reformatted input records are fixed-length with a record size of 82 bytes (an insignificant increase from the original size of 80 bytes). They look as follows:
Position
Contents
1-35
Input positions 1 through 35
36-37
Binary zeros (to prevent overflow)
38-82
Input positions 36 through 80

The MERGE and SUM statements must refer to the fields of the reformatted input records.

The reformatted output records are identical to the reformatted input records.

Thus, the 2-byte summary field at positions 36 and 37 in the original input records expands to a 4-byte summary field in positions 36 through 39 of the reformatted input/output record before merging. This prevents overflow of this summary field.

Restriction: If OUTREC were used instead of INREC, the records would be reformatted after merging, and the 2-byte summary field might overflow.

Note: This method of preventing overflow cannot be used for negative FI summary fields because padding with zeros rather than ones would change the sign.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014