cob Option Processing and Search Order

The cob command processes options from left to right. In general, if an option appears more than once, cob uses the setting that it processed last for that option. Some options, such as -C and -N that take Compiler directives, are cumulative.

You can specify cob options in a number of ways, and the method used determines the order in which cob processes them. The cob command searches for options in the following sequence:

  1. System default options in the file $COBDIR/etc/cobopt. This is the file the cob command reads when first invoked.

    The contents of the file $COBDIR/etc/cobopt affect the operation of COBOL for all users using the same $COBDIR; you should alter the file only after careful consideration of the implications.

  2. User default options in the environment variable COBOPT.
  3. Execution-time options on the cob command line.

Example

The file $COBDIR/etc/cobopt contains:

-U -P -C "ans85 noalter warning=1"

The cob command line specifies:

cob -xU -C alter -C warning=2 prog.cbl

In the above example, the cob command passes the COBOL source file prog.cbl to the Compiler with the final directive settings of ANS85 ALTER LIST"prog.lst" WARNING"2". An executable program prog is built, with any unresolved symbols being dynamically loaded at run time and flagged as missing at link time.