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


Example 11

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

    DISPLAY FROM(ACCTS) LIST(PLAIN) -
        TITLE('Accounts Report for First Quarter') -
        DATE(MD4/) BLANK -
        HEADER('Amount') ON(12,6,ZD) -
        HEADER(Id') ON(NUM) -
        HEADER('Acct#') ON(31,3,PD) -
        HEADER('Date') ON(1,4,ZD) -
        TOTAL('Total for Q1') -
        AVERAGE('Average for Q1')

 DISPLAY FROM(ACCTS) LIST(FANCY) -
        TITLE('Accounts Report for First Quarter') -
        DATE(MD4/) BLANK -
        HEADER('Amount') ON(12,6,ZD,C1,N08) -
        HEADER(Id') ON(NUM,N02) -
        HEADER('Acct#') ON(31,3,PD,NOST,LZ) -
        HEADER('Date') ON(1,4,ZD,E'99/99',NOST) -
        INDENT(2) BETWEEN(5) -
        STATLEFT -
        TOTAL('Total for Q1') -
        AVERAGE('Average for Q1')

This example shows some options you can use to improve the appearance of a DISPLAY report. The first DISPLAY operator produces a "plain" report, and the second DISPLAY operator uses the options shown in bold to produce a "fancy" report.

The PLAIN output starts on a new page and looks as follows:
Accounts Report for First Quarter               05/04/2001

         Amount                 Id                  Acct#                    Date
---------------    ---------------    -------------------    --------------------
          93271                  1                  15932                     106
         137622                  2                    187                     128
          83147                  3                  15932                     212
         183261                  4                   2158                     217
          76389                  5                    187                     305
         920013                  6                  15932                     319

Total for Q1
        1493703                                     50328                    1287

Average for Q1
         248950                                      8388                     214
The FANCY output starts on a new page and looks as follows:
Accounts Report for First Quarter             05/04/2001

                       Amount         Id        Acct#      Date
                     --------        ---       ------     -----
                       932.71          1        15932     01/06
                     1,376.22          2        00187     01/28
                       831.47          3        15932     02/12
                     1,832.61          4        02158     02/17
                       763.89          5        00187     03/05
                     9,200.13          6        15932     03/19

Total for Q1        14,937.03

Average for Q1       2,489.50
Here is an explanation of the extra options used for the "fancy" report:
  • First ON field: In the PLAIN report, BLANK causes ICETOOL to print the 6-byte ZD values as unedited digits with leading zeros suppressed. But for this example, we know the digits really represent dollars and cents. So in the FANCY report, we use the C1 formatting item (one of thirty-three available masks) to print the values with a comma (,) as the thousands separator and a period (.) as the decimal point.

    In the PLAIN report, TOTAL causes ICETOOL to allow 15 digits for the values because it does not know how many digits are needed. But for this example, we know the total amount will not exceed 8 digits. So in the FANCY report, we use the N08 formatting item to set the number of digits to 8. This decreases the column width for the field.

  • Second ON field: In the PLAIN report, NUM causes ICETOOL to allow 15 digits for the record number because it does not know how many digits are needed. But for this example, we know the number of records will not exceed 99. So in the FANCY report, we use the N02 formatting item to set the number of digits to 2. This decreases the column width for the record number.
  • Third ON field: In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to print the total and average for this 3-byte PD field. But for this example, we know we do not want statistics for the field because it is an account number. So in the FANCY report, we use the NOST formatting item to suppress the statistics for this field.

    In the PLAIN report, the default mask of A0 causes ICETOOL to suppress leading zeros for this 3-byte PD field. But for this example, we know that we want to show leading zeros for the field because it is an account number. So in the FANCY report, we use the LZ formatting item to print leading zeros for this field.

  • Fourth ON field: In the PLAIN report, BLANK causes ICETOOL to print the 4-byte ZD values as unedited digits with leading zeros suppressed. But for this example, we know the digits represent a date (month and day). So in the FANCY report, we use the E'99/99' formatting item to print the values with leading zeros and a slash (⁄) between the month and day.
    In the PLAIN report, TOTAL and AVERAGE cause ICETOOL to print the total and average for this 4-byte ZD field. But for this example, we know we do not want the total or average for this field because it is a date. So in the FANCY report, we use the NOST formatting item to suppress the statistics for this field.
    Note: In some applications, we might want the minimum and maximum for a date displayed with E'pattern', so we would not specify NOST for the date field.
  • INDENT: In the PLAIN report, ICETOOL starts the report in column 2 (after the control character), by default. But for this example, we want to indent the report a bit. So in the FANCY report, we use the INDENT(2) operand to indent the report by 2 blanks so it starts in column 4.
  • BETWEEN: In the PLAIN report, ICETOOL uses 3 blanks between the columns of data, by default. But for this example, we want more space between the columns. So in the FANCY report, we use the BETWEEN(5) operand to insert 5 blanks between the columns.
  • STATLEFT: In the PLAIN report, ICETOOL prints the strings for TOTAL and AVERAGE under the first column of data, by default, and uses two lines for each statistic to avoid having the string overlay the value. But for this example, we would like to have the TOTAL and AVERAGE strings stand out in the report and also have each string on the same line as its value. So in the FANCY report, we use the STATLEFT operand to print the TOTAL and AVERAGE strings to the left of the first column of data.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014