The COBOL runtime library uses the following environment variables. Case does not matter.
SET OUTPUTFILE=d:\january\results.car
You must set all assignment-names.
If you make an assignment to a user-defined word that is not set as an environment variable, the assignment is made to a file that has the literal name of the user-defined word (OUTPUTFILE in the example below). If the assignment is valid, this file is written to the current directory.
After you set an assignment-name, you can use that environment variable as a COBOL user-defined word in an ASSIGN clause.
Based on the previous SET statement, a COBOL source program could include the following SELECT and ASSIGN clause:
SELECT CARPOOL ASSIGN TO OUTPUTFILE
Because OUTPUTFILE is defined in an environment variable, the statement above results in data being written to the file d:\january\results.car.
You can use ASSIGN to specify a file stored in an alternate file system such as the standard language file system (STL), record sequential delimited file system (RSD), or Btrieve file system.
To capture runtime error messages in a file, use the SET command to set COBMSGS to a file-name. If your program has a runtime error that terminates the application, the file that COBMSGS is set to will contain an error message that indicates the reason for termination.
If COBMSGS is not set, error messages are written to the terminal.
This variable must be set to run programs that require dynamic loading. For example:
SET COBPATH=C:\pgmpath\pgmdll
Separate runtime options by a comma or a colon. Use parentheses or equal signs (=) as the delimiter for suboptions. Options are not case sensitive. For example, the following two commands are equivalent:
SET COBRTOPT=TRAP=ON,errcount SET COBRTOPT=trap(on):ERRCOUNT
The defaults for individual runtime options apply. For details, see the related reference below about runtime options.
To set the EBCDIC code page, issue the following command, where codepage is the name of the code page to be used:
SET EBCDIC_CODEPAGE=codepage
If EBCDIC_CODEPAGE is not set, the default EBCDIC code page is selected based on the current locale, as described in the related reference below about the locales and code pages supported. When the CHAR(EBCDIC) compiler option is in effect and multiple EBCDIC code pages are applicable to the locale in effect, you must set the EBCDIC_CODEPAGE environment variable unless the default EBCDIC code page for the locale is acceptable.
For example, the following command sets the language locale name to U.S. English:
SET LANG=en_US
LOCPATH is used for any operations that reference the locale, including locale-based comparisons of alphanumeric data items.
When you set NLSPATH, be sure to add to NLSPATH rather than replace it. Other programs might use this environment variable. For example:
SET NLSPATH=C:\cobolpath\MESSAGES\%L\%N;%NLSPATH%
%L and %N must be uppercase. %L is substituted by the value specified by the LANG environment variable. %N is substituted by the message catalog name used by COBOL.
Messages in the following languages are included with the product:
You can specify the languages for the messages and for the locale setting differently. For example, you can set the environment variable LANG to en_US and set the environment variable LC_ALL to ja_JP.IBM-943. In this example, any COBOL compiler or runtime messages will be in English, whereas native ASCII (DISPLAY or DISPLAY-1) data in the program is treated as encoded in code page IBM-943 (ASCII Japanese code page).
The compiler uses the combination of the NLSPATH and the LANG environment variable values to access the message catalog. If NLSPATH is validly set but LANG is not set to one of the locale values shown above, a warning message is generated and the compiler defaults to the en_US message catalog. If the NLSPATH value is invalid, a terminating error message is generated.
The runtime library also uses NLSPATH to access the message catalog. If NLSPATH is not set correctly, runtime messages appear in an abbreviated form.
If the environment variable is not set, by default SYSIN and SYSIPT are directed to the logical input device (keyboard). SYSOUT, SYSLIST, SYSLST, and CONSOLE are directed to the system logical output device (screen). SYSPUNCH and SYSPCH are not assigned a default value and are not valid unless you explicitly define them.
For example, the following command defines CONSOLE:
SET CONSOLE=c:\mypath\terminal.txt
CONSOLE could then be used in conjunction with the following source code:
SPECIAL-NAMES.
CONSOLE IS terminal
. . .
DISPLAY 'Hello World' UPON terminal
For example:
SET TMP=c:\shared\temp
SET TZ=SSS[+|-]nDDD[,sm,sw,sd,st,em,ew,ed,et,shift]
The defaults depend on the current locale.
When TZ is not present, the default is EST5EDT, the default locale value. When only the standard time zone is specified, the default value of n (difference in hours from GMT) is 0 instead of 5.
If you supply values for any of sm, sw, sd, st, em, ew, ed, et, or shift, you must supply values for all of them. If any of these values is not valid, the entire statement is considered invalid and the time-zone information is not changed.
For example:
SET TZ=CST6CDT
The preceding statement sets the standard time zone to CST, sets the daylight savings time to CDT, and sets a difference of six hours between CST and UTC. It does not set any values for the start and end of daylight savings time.
Other possible values are PST8PDT for Pacific United States and MST7MDT for Mountain United States.
related tasks
Using environment variables to specify a locale
Identifying files
related references
Locales and code pages that are supported
TZ environment parameter variables
CHAR
Runtime options