Compiler environment variables

COBOL for Linux® uses several compiler-only environment variables, as shown below.

Because COBOL words are case insensitive, all letters in COBOL words are treated as uppercase, including library-name and text-name. Thus environment variable names that correspond to such names must be uppercase. For example, the environment variable name that corresponds to COPY MyCopy is MYCOPY.

COBCPYEXT
Specifies the file suffixes to use in searches for copybooks when the COPY name statement does not indicate a file suffix. Specify one or more file suffixes with or without leading periods. Separate multiple file suffixes with a space or comma.

If COBCPYEXT is not defined, the following suffixes are searched: CPY, CBL, COB, and the lowercase equivalents cpy, cbl, and cob.

COBLSTDIR
Specifies the directory into which the compiler listing file is written. Specify any valid path. To indicate an absolute path, specify a leading slash. Otherwise, the path is relative to the current directory. A trailing slash is optional.

If COBLSTDIR is not defined, the compiler listing is written into the current directory.

COBOPT
Specifies compiler options. To specify multiple compiler options, separate each option by a space or comma. Surround the list of options with quotation marks if the list contains blanks or characters that are significant to the command shell. For example:

export COBOPT="TRUNC(OPT) TERMINAL"

Default values apply to individual compiler options.

Note: The compiler interprets certain shell scripting characters as follows:
  • An equal sign (=) is interpreted to a left parenthesis, (
  • A colon (:) is interpreted to a right parenthesis, )
  • An underscore (_) is interpreted to a single quotation mark (')

You can add a backslash (\) escape character to prevent the interpretation and thus to pass characters in the strings. If you want the backslash (\) to represent itself (rather than as an escape character), use the double backslash (\\).

library-name
If you specify library-name as a user-defined word, the name is used as an environment variable, and the value of the environment variable is used as the path in which to locate the copybook.

If you do not specify a library-name, the compiler searches the library paths in the following order:

  1. Current directory
  2. Paths specified by the -Ixxx option, if set
  3. Paths specified by the SYSLIB environment variable

The search ends when the file is found.

For more details, see the documentation of the COPY statement in the related reference about compiler-directing statements.

SYSLIB
Specifies paths to be used for COBOL COPY statements that have text-names that are unqualified by library-names. It also specifies paths to be used for SQL INCLUDE statements.
text-name
If you specify text-name as a user-defined word, the name is used as an environment variable, and the value of the environment variable is used as the file-name and possibly the path name of the copybook.

To specify multiple path names, delimit them with a colon (:).

For more details, see the documentation of the COPY statement in the related reference about compiler-directing statements.

Related concepts  
Db2 coprocessor