Use the cob2 command to compile and link COBOL programs from the z/OS UNIX shell. You can specify the options and input file-names in any order, using spaces to separate options and names. Any options that you specify apply to all files on the command line.
To compile multiple files (batch compilation), specify multiple source-file names.
When you compile COBOL programs for z/OS UNIX, the RENT option is required. The cob2 command automatically includes the COBOL compiler options RENT and TERM.
The cob2 command invokes the COBOL compiler that is found through the standard MVS search order. If the COBOL compiler is not installed in the LNKLST, or if more than one level of IBM COBOL compiler is installed on your system, you can specify in the STEPLIB environment variable the compiler PDS that you want to use. For example, the following statement specifies IGY.V4R1M0 as the compiler PDS:
export STEPLIB=IGY.V4R1M0.SIGYCOMP
The cob2 command implicitly uses the z/OS UNIX shell command c89 for the link step. c89 is the shell interface to the linker (the z/OS program management binder).
The default location for compiler input and output is the current directory.
Only files with the suffix .cbl are passed to the compiler; cob2 passes all other files to the linker.
The listing output that you request from the compilation of a COBOL source program file.cbl is written to file.lst. The listing output that you request from the linker is written to stdout.
The linker causes execution to begin at the first main program.