Skip to main content

Problem:

How to specify paths in an environment variable

Resolution:

The use of, and interpretation of, ":" and "." in PATH type variables (PATH, LD_LIBRARY_PATH etc) is often misunderstood.

":" is the directory separator. A colon at the beginning (or end) of the environment variable value means a null path at the beginning (end) of the search order. A null path means the same as ".". That is, the current working directory.

"::" in the middle of the env-var value is equivalent to ":.:", which obviously means search the current directory at that point in the order. A frequent mistake is "::" at the end of the value, which means search the current directory twice.

Example of setting COBDATA-

export COBDATA=:/home/data/directory

This would cause the search order to be the current directory then /home/data/directory

Incidentally - if you specify COBDATA then the current directory will not be searched unless it is specified in COBDATA.

COBDATA changes the locations used for COBOL  data files and should only be set while running COBOL application  programs. It should be unset during compiles and while running any licensing utilities. This applies to COBPATH as well. COBPATH is used for specifying the location of compiled COBOL modules. It should only be set at application runtime.

Old KB# 2119