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


Example 5

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

 SORT FIELDS=(6,5,CH,A)
 OUTFIL FNAMES=STATUS,
   HEADER2=(1:C'PAGE ',&PAGE,C' OF STATUS REPORT FOR ',&DATE,2/,
            6:C'ITEM ',16:C'STATUS      ',31:C'PARTS',/,
            6:C'-----',16:C'------------',31:C'-----'),
    OUTREC=(1,4,
            10:6,5,
            20:14,1,CHANGE=(12,
                            C'1',C'SHIP',
                            C'2',C'HOLD',
                            C'3',C'TRANSFER'),
                    NOMATCH=(C'*CHECK CODE*'),
            37:39,1,BI,M10,
            120:X)

This example illustrates how a report can be produced with a page header and columns of data from sorted variable-length input records, using a lookup table.

The FNAMES parameter specifies the ddname (STATUS) associated with the variable-length data set for the report.

The HEADER2 parameter specifies the page header to appear at the top of each page, which will consist of a line of text showing the page number (&PAGE) and date (&DATE), a blank line (2/), and two lines of text showing headings for the columns of data.

The OUTREC parameter specifies the RDW and three columns of data to appear for each input record as follows (remember that byte 5 is the first byte of data for variable-length records):
  • The character string from bytes 6 through 10 of the input record
  • A character string produced by finding a match for byte 14 of the input record in the table defined by CHANGE (lookup and change). NOMATCH indicates the character string to be used if byte 14 does not match any of the entries in the CHANGE table.
  • An edited numeric value produced by transforming the BI value in byte 39 according to the pattern specified by M10.

With variable-length input records, you must account for the RDW when specifying the c: values for OUTREC, but not for headers or trailers. The 1: used for the first line of HEADER2 causes it to start in the first data byte (by contrast, 5: must be used to specify the first OUTREC data byte for variable-length records). Also, because 6: is used for the ITEM heading, 10: must be used for the ITEM data to get the heading and data to line up in columns.

120:X is used at the end of the OUTREC parameter to ensure that the data records are longer than the report records. This will result in a maximum LRECL of 121 for the variable-length OUTFIL data set (1 byte for the ANSI control character and a maximum of 120 bytes for the data).

The first page of the printed report might start as follows:

PAGE      1 OF STATUS REPORT FOR 07/18/05

     ITEM      STATUS         PARTS
     -----     ------------   -----
     00082     HOLD              36
     00123     SHIP             106
     00300     *CHECK CODE*      95
     10321     TRANSFER          18
     12140     SHIP             120

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014