PL/I main procedure parameter passing considerations

The format of the parameter list passed to a PL/I main procedure from the operating system is controlled by the SYSTEM compiler option and also by options on the main PROCEDURE statement.

The SYSTEM compiler option specifies the format used to pass parameters to the PL/I main procedure, and indicates the host system under which the program runs: MVS™, CICS®, IMS™, or TSO. The SYSTEM option allows a program compiled under one system to run under another.

The NOEXECOPS procedure option indicates that runtime options are not present in the operating system parameter list. The NOEXECOPS option can be explicitly specified or implicitly defaulted. Otherwise, it is assumed that runtime options might be present in the operating system parameter list. If present, these runtime options are removed by runtime initialization before the PL/I main procedure gains control.

In order for runtime options to be passed in the operating system parameter list for SYSTEM(MVS), the PL/I main procedure must receive no parameters or receive a single parameter that is a varying character string. If this is not the case, NOEXECOPS is always defaulted.

The OPTIONS(BYVALUE) or OPTIONS(BYADDR) procedure options indicate if the main procedure parameters are passed directly or indirectly. If SYSTEM(IMS) or SYSTEM(CICS) is specified for an Enterprise PL/I for z/OS or a PL/I for MVS & VM main procedure, the OPTIONS(BYVALUE) procedure option is defaulted at compilation time, OPTIONS(BYADDR) is not permitted. When SYSTEM(CICS) and SYSTEM(IMS) is specified, Language Environment remaps the parameters to match the OPTIONS attribute BYADDR or BYVALUE of the main procedure. See Passing arguments between routines for additional information about Language Environment parameter passing.

The following tables describe the interaction of the PL/I SYSTEM and NOEXECOPS options. Their effect is described in terms of the parameters that are coded on the MAIN procedure statement and also the incoming system, subsystem, or assembler parameter list as initially received by Language Environment.

Table 1. Interactions of SYSTEM and NOEXECOPS
SYSTEM setting No runtime options (NOEXECOPS) Runtime options can be present
SYSTEM(MVS) If the main procedure parameter is a single varying character string, an MVS parameter list is assumed and repackaged so the main procedure receives a halfword-prefixed string. The entire string is passed to the main procedure without change.

Otherwise, the parameter list is passed without change.

If the main procedure parameter is a single varying character string, an MVS parameter list is assumed and repackaged so the main procedure receives a halfword-prefixed string. Any runtime options are removed from the string, and the (potentially) altered string is passed.

Otherwise, the parameter list is passed without change.

SYSTEM(IMS) The parameter list is passed without change. Not allowed
SYSTEM(CICS) The parameter list is passed without change. Not allowed
SYSTEM(TSO) Two levels of pointer indirection are added to the parameter list. The main procedure parameter should be a single pointer that points to the CPPL. Not allowed
Notes:
  1. NOEXECOPS is always implied for SYSTEM(CICS), SYSTEM(IMS), and SYSTEM(TSO). NOEXECOPS is also implied for SYSTEM(MVS), if the main procedure has more than one parameter or a single parameter that is not a varying character string.
  2. In an IMS environment, if an assembler program is driving a PL/I transaction where LANG is not specified or LANG=NON-PLI (except Pascal) under IMS V4R1, the parameter passes through without change. Otherwise, one level of indirection is removed from the parameter.

    If an assembler program is driving a transaction program written in Enterprise PL/I for z/OS or PL/I for MVS & VM, the main procedure of the transaction must be compiled with SYSTEM(MVS) option; the main procedure receives the parameter list passed from the assembler program in MVS style.