Passing Parameters

Because the parameter passing mechanisms on the mainframe vs. those on distributed platforms are completely different, Open PL/I provides the -gen_entry_dcl PL/I compiler option to help ensure that passed parameters are properly processed.

On the mainframe, a general purpose register points to a list of addresses that, in turn, point either to the actual argument or to a locator descriptor that addresses the argument and provides information about the extent of strings and aggregates. The high-order bit of the last address on the list is turned on. Using this mechanism, mismatched arguments and parameters can, to a certain extent, be tolerated.

However, on a distributed platform, arguments are passed via the hardware stack, which stores descriptors as separate entries in the stack. If an argument does not match its corresponding parameter, the mismatch can cause a run-time failure.

Enterprise Developer runs on a distributed platform, passing arguments via the hardware stack. As a consequence, it is imperative that each argument passed matches its corresponding parameter.

The best way to ensure that arguments and parameters match is to compile using the -gen_entry_dcl PL/I compiler option to provide a declaration of the ENTRY in the calling routine that includes the attributes of all the parameters. This enables the compiler to check that each argument matches its corresponding parameter and, if not, convert the actual argument to a dummy argument and issue a warning diagnostic or, if conversion is not possible, issue a severe diagnostic.

Note: If a dummy argument is generated, the called routine should be checked to ensure that it does not return a value through the corresponding parameter as this will not update the actual argument.

See -gen_entry_dcl for details.