Compiling programs

You can compile your COBOL programs from the command line or by using a shell script or makefile.

If you have non-IBM or free-format COBOL source, you might first need to use the source conversion utility, scu, to help convert the source so that it can be compiled. To see a summary of the scu functions, type the command scu -h. For further details, see the man page for scu, or see the related reference about the utility.

Specifying compiler options: There are several ways you can specify the options to be used when compiling COBOL programs. For example, you can:
  • Set the COBOPT environment variable from the command line.
  • Specify compiler options as options to the cob2, cob2_j, or cob2_r command. You can use these commands on the command line, in a shell script, or in a makefile.
  • Use PROCESS (CBL) or *CONTROL statements. An option that you specify by using PROCESS overrides every other option specification.

For further details about setting compiler options and the relative precedence of the methods of setting them, see the related reference about conflicting compiler options.