Previous Topic Next topic Print topic


cob (cob32 or cob64) Command

To invoke the Cob utility, enter the following from a UNIX system command prompt:

cob-command [options|filename] ...

Where:

cob-command
The version of the Cob utility to run, which can be:
cob
Executes the 32-bit or 64-bit version of the Cob utility depending on your effective working mode.

Your effective working mode is determined by the COBMODE environment variable, global settings or, if none of these is set, the default (64-bit). To show the effective working mode, enter cobmode at the command line without any arguments.

cob32
Executes the 32-bit version of the Cob utility.
cob64
Executes the 64-bit version of the Cob utility.
options
Either one cob option or a group of cob options comprising one or more cob flags.
filename
The name of an input file. These files can be any mixture of COBOL source code (.cbl, .CBL or .cob), intermediate code (.int), linkable object code (.o or .so), C source (.c), C++ source (.C), Assembler source (.s), or archive (.a) files.

The cob command assumes that any unrecognized options are either input files or valid linker options to be saved and used at link time. In this way, any archive files you supply to the cob command are passed to the linker, which pulls out only the referenced files from the archive.

Environment Requirements

The cob command needs to know the location of the COBOL system components, and so you need to ensure the following environment variables are set appropriately:

COBDIR

The cob command needs to know the location of the COBOL system components. They must all be located in a directory in which a COBOL system has been installed, as defined by the $COBDIR environment variable. The default $COBDIR directory is /usr/lpp/cobol on AIX, or /opt/lib/cobol otherwise.

If your COBOL system is not installed in the default location, you must set the COBDIR environment variable to point to the directory containing the system components. The pathname of the location must not exceed 51 characters.

You can install different versions of the COBOL system on your machine, in which case you select the one to use by setting its location in COBDIR. For example, the following specifies that the system components are located in the directory /home/products/cob10:

COBDIR=/home/products/cob10
export COBDIR
PATH
If the cob command is not on the UNIX search path, you must change the value of PATH. For example:
PATH=$COBDIR/bin:$PATH
export PATH
LIBPATH, SHLIB_PATH or LD_LIBRARY_PATH

Ensure that LIBPATH, SHLIB_PATH or LD_LIBRARY_PATH (depending on your operating system) is set to $COBDIR/lib.

TMPDIR
By default, files output by the cob command are put in the current directory. By default, any temporary files created are put in the system temporary directory; however, you can put them elsewhere by setting the TMPDIR environment variable and specifying a valid pathname.

Example

cob -xve "" -o my_rts -C xopen prog.cbl prog2.c

The above command passes the XOPEN directive to the Compiler and instructs cob to compile the COBOL source file prog.cbl and the C source file prog2.c and to link the result into a system executable file named my_rts that, when run, expects the name of the program to run to be given on its own command line. The cob utility also gives verbose notification of its progress.

The above command assumes that neither the file $COBDIR/etc/cobopt nor the COBOPT environment variable exist.

Previous Topic Next topic Print topic