Stratus Open VOS PL/I

Stratus has a very limited preprocessor, more comparable to C.

Each PL/I preprocessor statement begins with the percent-sign (%) character (for example, %do). The percent-sign character and the preprocessor statement cannot be separated by spaces. All other tokens must be separated by at least one space.

Preprocessor labels, GOTOs, procedures and iteration are not supported.

Statements:

    • The % (Null) Statement

  • The %do and %end Statements

The %do preprocessor statement introduces a %do-group; the %end preprocessor statement ends a %do-group. A %do-group contains one or more PL/I language statements (including null statements) and preprocessor statements that are evaluated during the first phase of compilation. A %do-group has the following syntax.

%do;

.

.

.

%end;

Note that iterative DOs are not allowed.

    • The %if Statement

The %if preprocessor statement evaluates an expression as true or false and controls subsequent compilation. The %if statement has the following syntax.

%if expression

%then statement

[%else statement]

The compiler evaluates expression to a scalar bit value. If expression is true (that is, the value is 1), the %thenexpression is false (the value is 0), compilation resumes with the %else clause or the next statement after the construct if no %else clause is specified. clause is compiled; if

IWithin expression, the operands can be decimal constants, bit constants, or character constants. If a %replace synonym is used in place of a constant, the synonym must have been previously defined within the compilation unit. (See The %replace Statement. later in this chapter, for more information on %replace.)

The following rules govern operand conversion in an %if expression.

    • For arithmetic operations, each operand is converted to fixed dec(5,0) before the operation is performed, and the result is converted to fixed dec(5,0). The null string is assigned the value 0 if it is converted to integer.

    • Any character value being converted to an arithmetic value must be an optionally signed integer.

    • Converting a fixed-point value to a bit value results in a bit string of length 17.

    • Converting a fixed-point decimal value to a character value results in a character string of length 8; leading zeros are replaced by spaces, and the rightmost space is replaced by a minus sign if the value is negative.

Like other PL/I conditional expressions, a PL/I-preprocessor conditional expression can use any arithmetic, relational, bit-string, or concatenate operator, with the exception of the exponentiation operator. The conditional expression cannot contain any function references, including references to built-in functions.

The statement following the %then or %else clause can be a preprocessor statement, a %do-group, or another PL/I statement that is suitable for use with a then or else PL/I language statement.

    • The %include Statement

The %include preprocessor statement inserts the contents of a text file into the program in place of the %include statement.

The %include statement has the following syntax.

%include 'file_name';

  • The %list Statement

The %list preprocessor statement re-enables the compiler's listing option after it has been disabled by the %nolist%list statement has the following syntax. preprocessor statement. The

%list;

  • The %nolist Statement

The %nolist preprocessor statement disables the compiler's listing option. The %nolist statement has the following syntax.

%nolist;

    • The %options Statement

The %options preprocessor statement specifies certain compiler options within the source module.

The %options statement has the following syntax.

You can specify the following compiler options in the %options statement.

    • default_char_set

    • mapcase or no_mapcase

      • max_fixed_bin

    • processor

    • system_programming or no_system_programming

    • untyped_storage_sharing

    • default_mapping or no_default_mapping

    • the following alignment options: longmap, shortmap, longmap_check, and shortmap_check

  • The %page Statement

The %page preprocessor statement starts a new page in the compilation listing. The %page statement has the following syntax.

%page;

  • The %replace Statement

The %replace preprocessor statement creates a synonym for a literal constant or declared name within a program. The %replace statement has the following syntax.

%replace synonym by

;

A synonym cannot be replaced by more than one value in a program. For example, the following sequence is not allowed.

%replace SIZE by 100;

.

.

.

%replace SIZE by 50;

Two identical %replace statements are allowable, as shown in the following example.

%replace SIZE by 100;

.

.

.

%replace SIZE by 100;

Builtin Functions: none. (N/A)

http://stratadoc.stratus.com/vos/17.0.2/r009-05/wwhelp/wwhimpl/js/html/wwhelp.htm?context=r009-05&file=ch1r009-05.html