Accessing main program parameters under z/OS UNIX

When you run a COBOL program from the z/OS® UNIX shell command line or with an exec() or spawn() function, the parameter list consists of three parameters passed by reference. You can access these parameters with standard COBOL coding.

About this task

argument count
A binary fullword integer that contains the number of elements in each of the arrays that are passed in the second and third parameters.
argument length list
An array of pointers. The nth entry in the array is the address of a fullword binary integer that contains the length of the nth entry in the argument list.
argument list
An array of pointers. The nth entry in the array is the address of the nth character string passed as an argument in the spawn() or exec() function or in the command invocation. Each character string is null-terminated.

This array is never empty. The first argument is the character string that represents the name of the file associated with the process being started.

Example: accessing main program parameters under z/OS UNIX