COBOL programs are supported under z/OS® UNIX.
In order to use COBOL under z/OS UNIX, the COBOL programs must be
compiled with the Enterprise COBOL for z/OS compiler, COBOL for OS/390 & VM compiler
or the COBOL for MVS & VM compiler,
and the programs must be compiled with the RENT compiler option.
You can compile and link edit your COBOL programs in the z/OS UNIX shell
with the cob2 command. The cob2 command
is available with COBOL for OS/390 & VM V2R2
or Enterprise COBOL for z/OS.
Alternatively, you can compile your programs in TSO or batch and
have the object module written to a z/OS UNIX file by using the PATH parameter
instead of the DSNAME parameter for the SYSLIN DD. Once you have your
object modules in a z/OS UNIX file, you can use the c89 utility
to create an executable file.
When you want to use COBOL programs under z/OS UNIX,
be aware of the following situations:
- When COBOL is the main routine of a z/OS UNIX, process, parameters are not
passed in the C argv and argc format.
Instead the parameter list consists of three parameters passed by
reference:
- Argument-count: a binary fullword integer containing the number
of elements in each of the arrays that are passed as 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 containing the
length of the Nth entry in the Argument-list (the third argument).
- Argument-list: an array of pointers. The Nth entry in the array
is the address of the Nth character string passed as an argument on
the spawn(), exec(), or command
invocation.
COBOL programs are not recommended as main programs because
they are not portable to other platforms. Instead, use a C main routine
and have it call the COBOL programs.
- DISPLAY UPON SYSOUT data is written to stdout unless a DD is allocated
that matches the value in the OUTDD compiler option.
- In order to run COBOL programs in more than one thread, all of
the COBOL programs have to be compiled with the Enterprise COBOL compiler
using the THREAD compiler option.
- The COBOL SORT and MERGE statements are not supported.
For more information about compiling, link-editing, and running
COBOL programs in a z/OS UNIX shell
environment, see the appropriate version of the programming
guide in the COBOL library at Enterprise COBOL for z/OS library.