Statements

You use identifiers, delimiters, operators, and constants to construct PL/I statements.

Although your source program consists of a series of records or lines, PL/I views the program as a continuous stream of characters. There are few restrictions in the format of PL/I statements, and programs can be written without considering special coding rules or checking to see that each statement begins in a specific column. A statement can begin in the next position after the previous statement, or it can be separated by any number of blanks.

Some statements begin with a % symbol. These statements are either %directives that direct preprocessor and compiler operations (controlling listings, including program source text from a library, and so on) or are PL/I macro facility %statements. A %directive must be on a line by itself.

To improve program readability and maintainability and to avoid unexpected results caused by loss of trailing blanks in source lines, follow these guidelines:

  • Do not split a language element across lines. If a string constant must be written on multiple lines, use the concatenation operator (∥).
  • Do not write more than one statement on a line.
  • Do not split %directives across lines.

The PL/I statements, macro facility %statements, and the %directives are alphabetically listed in Statements and directives.

Syntax for a PL/I statement

Read syntax diagramSkip visual syntax diagramcondition-prefixlabel-prefixstatement
Syntax for a %directive

Read syntax diagramSkip visual syntax diagram%statement
Syntax for a %statement:

Read syntax diagramSkip visual syntax diagram% label-prefix statement
Syntax for a macro statement

Read syntax diagramSkip visual syntax diagram label-prefix statement

Every statement must be contained within some enclosing group or block. Macro statements must be contained within some enclosing macro group or procedure.

condition-prefix
A condition prefix specifies the enabling or disabling of a PL/I condition (see Condition handling).
label-prefix
A label prefix is one or more statement labels. It identifies a statement so that it can be referred to at some other point in the program. Statement labels are either label constants (see Label data and LABEL attribute), entry constants (see Entry data), or format constants (see Format data and FORMAT attribute).

Any statement, except DECLARE, DEFAULT, WHEN, OTHERWISE, and ON statements, can have a label prefix. Use the following syntax for a label prefix.

Read syntax diagramSkip visual syntax diagramidentifier:

The syntax for individual statements throughout this book generally does not show the condition prefix or the label prefix.

statement
A simple or a compound statement.