Using Language Environment parameter list formats

This topic describes how to pass parameters to external routines under Language Environment. The methods described do not apply to internal routines or to compiled code that invokes its own library routines. Each Language Environment-conforming HLL might have its own method for transferring control and passing arguments between internal routines.

When writing a Language Environment-conforming application, it is important to consider how parameters are passed to the application on invocation. The type of parameter list created by the operating system and passed to Language Environment when an application is run varies according to the operating system or subsystem used. Language Environment repackages the various formats so that what is actually passed to the main routine when it is invoked on most supported operating systems is a halfword prefixed character string. In C and C++, you can pass arguments to the main routine through argv and argc. If you set up your C, C++, COBOL, or PL/I main routine according to the rules of the language, you generally do not need to do anything special to receive parameters from the operating system.

Fortran does not support passing parameters to a main routine.

On operating subsystems such as CICS® and IMS™, however, the parameter format that is passed might be different from what your main routine expects. In these cases, you must explicitly code your main routine to accept the format of the parameters as they are passed by CICS and IMS.

Preparing your main routine to receive parameters contains examples of how to code your main routine to receive parameters under any supported operating system or subsystem.

Additionally, some HLLs, such as C, C++, and PL/I, provide options that enable you to specify the format of the parameter list you expect to be passed to your main routine. For example, C programmers can specify the PLIST runtime option, which determines the parameter list format. If your HLL provides such an option, refer to one of the following for information about which settings you should select to run an application:
TSO/E
Table 1
IMS
Table 2
CICS
Table 3
MVS™
Table 4

When running most main routines, you do not need to explicitly access the parameter list. Language Environment provides the CEE3PRM and CEE3PR2 callable service to query and return to your calling routine the parameter string passed to your main routine when it was invoked. The returned parameter string contains only program arguments. If no program arguments were specified, a blank string is returned. See z/OS Language Environment Programming Reference for more information about CEE3PRM and CEE3PR2.

In addition, some HLLs, such as C and C++, provide ways of identifying passed parameters to your main routine using constructs within the HLL itself. For more information, see C and C++ parameter passing considerations.