The OPTIONS option can be specified on PACKAGE, PROCEDURE, ENTRY, and BEGIN statements. The OPTIONS attribute can be specified on ENTRY declarations. It is used to specify processing characteristics that apply to the block and the invocation of a procedure. The options shown in the following syntax diagrams are listed alphabetically and discussed starting in ***.
The options are separated by blanks or commas. They can appear in any order.
The ASSEMBLER option has the same effect as NODESCRIPTOR.
If a procedure has the ASSEMBLER option, then upon exit from that procedure, the PLIRETV() value will be used as the return value for the procedure.
For more information, refer to the Programming Guide.
BYVALUE can be specified only for scalar arguments and parameters that have known lengths and sizes.
The BYVALUE and BYADDR attributes can also be specified in the description list of an entry declaration and in the attribute list of a parameter declaration. Specifying BYVALUE or BYADDR in an entry or a parameter declaration overrides the option specified in an OPTIONS statement.
The following examples show BYVALUE and BYADDR in both entry declarations and in the OPTIONS statement. The examples assume that the compiler option DEFAULT(BYADDR) is in effect.
Example 1
MAINPR: proc options(main);
dcl D entry (fixed bin byaddr,
ptr,
char(4) byvalue) /* byvalue not needed */
options(byvalue);
dcl E2 entry; /* default(byaddr) in effect */
dcl Length fixed bin,
P pointer,
Name char(4);
call D(Length, P, Name); /* Length is passed byaddr */
/* P is passed by value */
/* Name is passed by value */
call E2(P); /* P is passed by address */
D: proc(I, Q, C)
options(byvalue);
dcl I fixed bin byaddr,
Q ptr,
C char(4) byvalue;
E2: proc(Q);
dcl Q ptr;
Example 2
dcl F entry (fixed bin byaddr, /* byaddr not needed */
ptr,
char(4) byvalue)
options(byaddr);
dcl E3 entry;
dcl E4 entry (fixed bin byvalue);
call F(Length, P, Name); /* Length is passed byaddr */
/* P is passed byaddr */
/* Name is passed by value */
call E3(Name); /* Name is passed byaddr */
call E4(Length); /* Length is passed by value */
F: proc(I,P,C) options(byaddr);
dcl I fixed bin byaddr; /* byaddr not needed */
dcl P ptr byaddr; /* byaddr not needed */
dcl C char(4) byvalue; /* byvalue needed */
E3: proc(L);
dcl L char(4);
E4: proc(N);
dcl N fixed bin byvalue;
The default for an external procedure is NOCHARG. Internal procedures and begin-blocks inherit their defaults from the containing procedure.
When CHARG is in effect, the following semantic changes occur:
Name: procedure options(chargraphic);
dcl A char(5);
dcl B char(8);
/* the following statement... */
(stringsize): A=B;
/*...is logically transformed into... */
A=mpstr(B,'vs',length(A));
When NOCHARG is in effect, no semantic changes occur.
If DESCRIPTOR appears, the compiler passes descriptors, if necessary.
If NODESCRIPTOR appears, the compiler does not pass descriptors.
If neither appears, DESCRIPTOR is assumed only when one of the invoked procedure's parameters is a string, array, area, structure, or union.
It is an error for NODESCRIPTOR to appear on a procedure statement or entry declaration in which any of the parameters or elements:
However, NODESCRIPTOR is allowed if the parameters with unspecified extents are NONASSIGNABLE VARYING or VARYINGZ strings.
The DLLINTERNAL attribute is valid only on EXTERNAL procedures or ENTRYs.
The FETCHABLE attribute is not valid on INTERNAL procedures.
FETCHABLE procedures should not be linked into a load module that contains a MAIN procedure.
INLINE indicates that whenever the begin-block or procedure is invoked in the package that defines it, the code for the begin-block or procedure should be executed inline at the point of its invocation. Even if INLINE is specified, the compiler can choose not to inline the begin-block or procedure.
NOINLINE indicates that the begin-block or procedure is never to be executed inline.
OPTIONS(INLINE) makes it easier to write well-structured, readable code. For instance, a program could be written as a series of calls to a set of procedures, and OPTIONS(INLINE) could be used to eliminate the overhead of actually calling these procedures one by one.
If a procedure or begin-block is executed inline, the values returned by built-in functions like ONLOC return the name of the procedure into which it is inlined. Similarly, traceback information does not include the called procedure.
Some procedures and begin-blocks are never inlined. These include, but are not limited to:
If a non-nested procedure with the INLINE option is not external and not referenced, no code will be generated for it. If neither INLINE nor NOINLINE is specified for a procedure, the option is set by the DEFAULT compiler option.
For more information about using INLINE and NOINLINE, refer to the Programming Guide.
For more information about calling conventions, refer to the Programming Guide.
A PL/I program that contains more than one procedure with OPTIONS(MAIN) can produce unpredictable results.
Each option argument-list may specify the parameters to which the option applies. Parameters may appear in any order and are separated by commas or blanks. If there is no argument-list for an option, the default list is all the parameters of the entry name.
NOMAP, NOMAPIN and NOMAPOUT may all appear in the same OPTIONS specification. This specification should not include the same parameter in more than one specified or default argument list.
These options are accepted but ignored unless the COBOL option applies.
ORDER indicates that only the most recently assigned values of variables modified in the block are available for ON-units that are entered because of computational conditions raised during statement execution and expressions in the block.
The REORDER option allows the compiler to generate optimized code to produce the result specified by the source program when error-free execution takes place.
For more information on using the ORDER and REORDER options, refer to the Programming Guide.
If neither option is specified for the external procedure, the default is set by the DEFAULT compiler option. Internal blocks inherit ORDER or REORDER from the containing block.
REDUCIBLE indicates that a procedure or entry need not be invoked multiple times if the argument(s) stays unchanged, and that the invocation of the procedure has no side effects.
For example, a user-written function that computes a result based on unchanging data should be declared REDUCIBLE. A function that computes a result based on changing data, such as a random number or time of day, should be declared IRREDUCIBLE.

This option automatically implies LINKAGE(STDCALL) and EXT('WinMain'). The associated routine should contain four parameters:
These are the same four parameters expected by the C WinMain and the calls made from this routine are the same as those expected from a C routine.
