Accessing main program parameters under z/OS

When you run an Enterprise COBOL program under z/OS® and pass the program a parameter string, for example, by using JCL or a TSO command, the parameter list consists of a character string that has a halfword prefix that contains the string length.

About this task

You can access the parameter string by using a LINKAGE SECTION and standard COBOL coding as shown in the example referenced below:

Example: accessing main program parameters under z/OS

Alternatively, you can obtain the parameter string by calling either of the following Language Environment® callable services, which are described in the Related references below:
  • CEE3PRM (query parameter string): obtain the parameter string (if not longer than 80 characters)
  • CEE3PR2 (query parameter string long): obtain the parameter string and its length

In either case, the parameter string might contain program arguments, runtime options, or both. The setting of the CBLOPTS runtime option determines the relative order in which program arguments and runtime options are expected. If CBLOPTS(ON) (the default) is in effect, and program arguments and runtime options are both passed in the parameter string, they must appear in the following order, separated by a forward slash:

program_arguments/runtime_options

For further details, see the related information referenced below.

Related tasks  
Coding the LINKAGE SECTION  
Accessing main program parameters under z/OS UNIX  
Accessing JCL parameters
Language Environment Programming Guide (Specifying runtime options and
   program arguments, Preparing your main routine to receive parameters)  

Related references  
Language Environment Customization (CBLOPTS (COBOL only))
Language Environment Programming Reference (CEE3PRM, CEE3PR2)