Previous Topic: INVERT StatementNext Topic: LOOP Statement


LIST Statement

The LIST statement sends data to the RUNLIST output file. LIST is useful for displaying simple messages or for displaying the contents of fields for debugging. The Report Definition Facility (see Generating Reports) and the PRODUCE statement (described in this chapter) provide more flexible report specification.

The first format of the LIST statement sends variables or literals to the RUNLIST output file. In z/OS batch, this is the file with the RUNLIST DD name. In VSE batch, this is SYSLIST. This is the file in the output library with an output name identical to the main program. You can browse or print this output later.

This statement has the following format:

LIST [ERROR | list_specification]
list_specification

Specifies the data to list. The format is:

{numeric_field   }[     {numeric_field    }]
{date_field      }[     {date_field       }]
{alpha_expression}[ [,] {alpha_expression }] 
{flag            }[     {flag             }] ...
{SKIP            }[     {SKIP             }]
{PANEL panelname }[     {PANEL panelname  }]
{NEWPAGE         }[     {NEWPAGE          }]

For more information about definitions of numeric_field, date_field, alpha_expression, and flag, see section, PDL Language Elements in the chapter one.

SKIP

Causes the listing to skip to a new line.

PANEL panelname

Writes an image of the named panel with the current field values. A panel wider than 132 characters is truncated.

NEWPAGE

Causes the listing to skip to the top of the next page.

ERROR (Only in an error procedure or WHEN ERROR clause.)

Lists information about an error condition that terminated a run. LIST ERROR automatically displays the value of the $RETURN‑CODE function. For further information on error conditions, refer to the $ERROR and $RETURN‑CODE functions in Chapter 5 and error procedure in this chapter.

On output, items on the same line are separated from each other by one blank.

If a numeric or date field is identified in a list_specification, the value of the field is first converted internally with $STRING and the result is listed.

For a variable length field, the actual length is listed.

An item with a value of null is listed as a question mark (?) or by the character specified using the SET REPORT NULLSYM command.

You can override the destination of the LIST output with an ASSIGN REPORT RUNLIST statement (or command). This statement lets you assign a destination and a disposition to the RUNLIST output. For more information, see the ASSIGN REPORT command in the Command Reference Guide.

Example

LIST 'THE ANSWER IS' X, Y 'ON', Z
:  This results in the concatenation of the values
:  of the designated literals and identifiers
:  with one blank between each.

If X='PLACE', Y='HAT', and Z='TABLE' the output line is:

THE ANSWER IS PLACE HAT ON TABLE