IBM PL/I for MVS and VM

Statements:

    • %ACTIVATE statement makes an identifier active and eligible for replacement. Any subsequent encounter of that identifier in the input text while the identifier is active initiates replacement activity. The syntax for the %ACTIVATE statement is:

<_,________________________

_RESCAN___ |

>>__%__ ____________ __ACTIVATE____identifier__|__________|_|__;________><

| <________ | |_NORESCAN_|

|___label:_|_|

    • A %assignment statement evaluates a preprocessor expression and assigns the result to a preprocessor variable. The syntax for the %assignment statement is:

>>__%__ ____________ __preprocessor-variable = preprocessor-expression___>

| <________ |

|___label:_|_|

>__;____________________________________________________________________><

    • A %DEACTIVATE statement makes an identifier inactive. The syntax for the %DEACTIVATE statement is:

<_,__________

>>__%__ ____________ __DEACTIVATE____identifier_|__;____________________><

| <________ |

|___label:_|_|

    • The %DECLARE statement establishes an identifier as a preprocessor name, specifies attributes of the name, and establishes the scope of the name.

A %DECLARE statement behaves as a %ACTIVATE statement when it is encountered outside a preprocessor procedure, and activates, with the RESCAN option, all identifiers declared in the %DECLARE statement. The syntax for the %DECLARE statement is:

<_,_________________________

>>__%__ ____________ __DECLARE____identifier__ _FIXED_____ _|__;________><

| <________ | |_CHARACTER_|

|___label:_|_| |_ENTRY_____|

|_BUILTIN___|

    • The %DO statement, and its corresponding %END statement, delimit a preprocessor do-group, and can also specify repetitive execution of the do-group. The syntax for the %DO statement is:

Type 1:

>>__%__ ____________ __DO__;____________________________________________><

| <________ |

|___label:_|_|

Type 3:

>>__%__ ____________ __DO__| preprocessor-do-specification |__;_________><

| <________ |

|___label:_|_|

preprocessor-do-specification:

|__preprocessor-variable = preprocessor-exp1_____________________________>

>__ __________________________________________________ __________________|

|_TO__preprocessor-exp2__ _______________________ _|

| |_BY__preprocessor-exp3_| |

|_BY__preprocessor-exp3__ _______________________ _|

|_TO__preprocessor-exp2_|

    • The %END statement is used in conjunction with %DO or %PROCEDURE statements to delimit preprocessor do-groups or preprocessor procedures. The syntax for the %END statement is:

>>__%__ ____________ __END__ _______ __;________________________________><

| <________ | |_label_|

|___label:_|_|

The label following END must be a label of a %PROCEDURE or %DO statement. Multiple closure is allowed.

    • The %GO TO statement causes the preprocessor to continue its scan at the specified label. The syntax for the %GO TO statement is:

>>__%__ ____________ __GO__TO__label__;_________________________________><

| <________ |

|___label:_|_|

Abbreviation: %GOTO

The label following the GO TO specifies the point to which the scan is transferred. It must be a label of a preprocessor statement, although it cannot be the label of a preprocessor procedure.

A preprocessor GO TO statement appearing within a preprocessor procedure cannot transfer control to a point outside of that procedure. In other words, the label following GO TO must be contained within the procedure.

    • The %IF statement controls the flow of the scan according to the bit value

of a preprocessor expression. The syntax for the %IF statement is:

>>__%__ ____________ __IF__preprocessor-expression__%__THEN______________>

| <________ |

|___label:_|_|

>__preprocessor-unit1__ _____________________________ __________________><

|_%__ELSE__preprocessor-unit2_|

preprocessor-expression Is evaluated and converted to a bit string (if the conversion cannot be made, it is an error).

preprocessor-unit Is any single preprocessor statement (other than %DECLARE, %PROCEDURE, %END, or %DO) or a preprocessor do-group.

    • The %INCLUDE statement is used to incorporate source code from an external library into the source program. Do not put other statements on the same line as the %INCLUDE statement.

The syntax for the %INCLUDE statement is:

>>__%INCLUDE__ _member________________ __;______________________________><

|_dataset__(__member__)_|

    • The %NOPRINT statement causes printing of the source and insource listings to be suspended until a %PRINT statement is encountered. The syntax for the %NOPRINT statement is:

>>__%NOPRINT__;_________________________________________________________><

The %NOPRINT statement must be on a line with no other statements. It must not appear within another statement.

    • The %NOTE statement generates a preprocessor diagnostic message of specified text and severity. The syntax for the %NOTE statement is:

>>__%__ ____________ __NOTE__(__message__ _________ __)__;______________><

| <________ | |_,__code_|

|___label:_|_|

    • The %null statement does nothing and does not modify sequential statement execution. The syntax for the %null statement is:

>>__%__;________________________________________________________________><

    • The statement following a %PAGE statement in the program listing is printed on the first line (after the page headings) of the next page. The syntax for the %PAGE statement is:

>>__%PAGE__;____________________________________________________________><

This statement controls both the insource and the source listing.

For paging to take place, the %PAGE statement must be on a line with no other statements.

When paging takes place, %PAGE does not appear in the formatted listing.

    • The %PRINT statement causes printing of the source and insource listings to be resumed. The syntax for the %PRINT statement is:

>>__%PRINT__;___________________________________________________________><

%PRINT is in effect at the onset of both the insource and the source listings, provided that the relevant compile-time options are specified.

    • The %PROCEDURE statement is used in conjunction with a %END statement to

delimit a preprocessor procedure. The syntax for the %PROCEDURE statement

is:

<___________ >>__%___entry-name:|__PROCEDURE__ _____________________ _________________>

| <_,_________ |

|_(____parameter_|__)_|

>__ ___________ __RETURNS__(__ _CHARACTER_ __)__;_______________________><

|_STATEMENT_| |_FIXED_____|

    • The %PROCESS statement is used to override compile-time options.

<___________________ |

>>__%PROCESS__ _________________ |_;____________________________________><

|_compiler-option_|

The % must be the first data position of a source record. Any number of %PROCESS statements can be specified, but they must all appear before the first language element appears.

    • The preprocessor RETURN statement can be used only in a preprocessor procedure and, therefore, can have no leading %. It returns a value as well as control back to the point from which the preprocessor procedure was invoked. At least one RETURN statement must appear in each preprocessor procedure.

The value returned by a preprocessor function procedure to the point of invocation is specified by the preprocessor-expression in a RETURN statement in the procedure. The syntax of the preprocessor RETURN statement is:

>>__ ____________ __RETURN__(__preprocessor-expression__)__;____________><

| <________ |

|___label:_|_|

    • %SKIP statement. The specified number of lines following a %SKIP statement in the program

listing are left blank. The syntax for the %SKIP statement is:

>>__%SKIP__ _________ __;_______________________________________________><

|_(__n__)_|

Builtins:

    • COMPILETIME returns a character string, length 18, in the format of DDbMMMbYYmHH.MM.SS. The character string contains the date and the time of compilation. The syntax for COMPILETIME is:

>>__COMPILETIME_________________________________________________________><

The returned character string represents:

b Blank

DD Day of the month

MMM Month in the form JAN, FEB, MAR, etc.

YY Year

HH Hour

MM Minute

SS Second

    • COUNTER returns a character string, length 5, containing a decimal number.

The returned number is 00001 for the first invocation, and is incremented

by one on each successive invocation. The syntax for COUNTER is:

>>__COUNTER_____________________________________________________________><

    • INDEX returns a FIXED value indicating the starting position within the character expression x of a substring identical to character expression y. The syntax for INDEX is:

>>__INDEX__(__x__,__y__)________________________________________________><

    • LENGTH returns a FIXED value specifying the current length of a given character expression x. The syntax for LENGTH is:

>>__LENGTH__(__x__)_____________________________________________________><

    • The PARMSET built-in function can be used only within a preprocessor procedure. It is used to determine whether a specified parameter is set on invocation of the procedure. The syntax for PARMSET is:

>>__PARMSET__(__x__)____________________________________________________><

x Must be a parameter of the preprocessor procedure.

PARMSET returns a bit value of '1'B if the parameter x was explicitly set by the function reference which invoked the procedure, and a bit value of '0'B if it was not.

    • SUBSTR returns a substring of the character expression x. The syntax for SUBSTR is:

>>__SUBSTR__(__x__,__y__ ______ __)_____________________________________><

|_,__z_|