Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Setting environment variables under UNIX

An environment variable is a name that is associated with a string of characters and that defines some variable aspect of the program environment. You use environment variables to set values that programs, including the compiler, need.

Set the environment variables for the compiler by using the export command. For example, to set the SYSLIB variable, issue the export command from the shell or from a script file:

export SYSLIB=/u/mystuff/copybooks

The value that you assign to an environment variable can include other environment variables or the variable itself. The values of these variables apply only when you compile from the shell where you issue the export command. If you do not set an environment variable, either a default value is applied or the variable is not defined. The environment-variable names must be uppercase.

The environment variables that you can set for use by the compiler are as follows:

COBOPT
Specify compiler options separated by blanks or commas. Separate suboptions with commas. Blanks at the beginning or the end of the variable value are ignored. Delimit the list of options with quotation marks if it contains blanks or characters that are significant to the z/OS UNIX shell. For example:
export COBOPT="TRUNC(OPT) XREF"
SYSLIB
Specify paths to directories to be used in searching for COBOL copybooks if you do not specify an explicit library-name in the COPY statement. Separate multiple paths with a colon. Paths are evaluated in order from the first path to the last in the export command. If you set the variable with multiple files of the same name, the first located copy of the file is used.

For COPY statements in which you have not coded an explicit library-name, the compiler searches for copybooks in this order:

  1. In the current directory
  2. In the paths you specify with the -I cob2 option
  3. In the paths you specify in the SYSLIB environment variable
library-name
Specify the directory path from which to copy when you specify an explicit library-name in the COPY statement. The environment-variable name is identical to the library-name in your program. You must set an environment variable for each library; an error will occur otherwise. The environment-variable name library-name must be uppercase.
text-name
Specify the name of the file from which to copy text. The environment-variable name is identical to the text-name in your program. The environment-variable name text-name must be uppercase.

related references  
Compiler-directing statements  
Compiler options  
COPY statement (Enterprise COBOL Language Reference)


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)