The environment variables (also called shell variables) described in this section affect the operation of commands, functions and applications. There are other environment variables that are of interest only to specific commands (refer to the keyword "shell variables" in the manual "POSIX Commands" [2 (Related publications)]). When a process begins execution, an array of strings called the environment is made available by the exec
functions (see exec
). The following external variable points to this vector:
extern char **environ;
In accordance with the XPG4 Version 2 standard, these strings have the form "name=value", e.g. "PATH=/sbin:/usr/sbin"
.
Applications may also define their own environment variables, provided the naming conventions are complied with (see manual "POSIX Commands" [2 (Related publications)]).
Supplying the environment variables with default values from BS2000
If a program is not started from the shell but from SDF-environment via /START-EXECUTABLE-PROGRAM
, the environment variables are not defined by default.
In this case you can supply them with default values from within BS2000 by defining an SDF-P variable with the name SYSPOSIX
as a structure (see the manual "SDF-P" [9 (Related publications)]). When the value of the variable SYSPOSIX
.name is value, the string "name=value" is written to the global data area of the program; however, only variables of the type ’string’ are taken into account.
Only uppercase letters may be used for variable names at the BS2000 command level. Hyphens in the names of SDF-P variables are converted to underscores, e.g. SYSPOSIX.LC-NAME
would be converted to the string "LC_NAME=...
".
Environment variables for internationalization
An internationalized program makes no fixed assumptions about its runtime environment. It determines its specific runtime environment from environment variables.
For example, the environment for displaying outputs is determined from the environment variables LANG
and LC_
xxx, while the functions for processing message catalogs interpret the NLSPATH
environment variable.
The following environment variables are supported for internationalization:
| Determines the locale category for native language, local customs and coded character set in the absence of
For example, a user from Austria who speaks German and is using a terminal with the ISO 8859/1 character set would set the
This enables a user to find the appropriate message catalogs, assuming that they exist. Specific language operations are initialized at runtime by calling the
| ||||||||||||||
| On X/Open systems, this form of a | ||||||||||||||
| This category specifies the collation sequence to be used. The related information is stored in a database that is created by the | ||||||||||||||
| This category determines character classification, case conversion, and the size of multi-byte characters. The related information is stored in a database that is created by the | ||||||||||||||
| This category determines the language of the message catalog used. For example, an application may have one message catalog with French messages and another containing messages in German. | ||||||||||||||
| Specifies the currency symbols and separators for a specific environment. | ||||||||||||||
| This category defines the separators for decimal places and thousands. | ||||||||||||||
| This category specifies the date and time formats. The environment variable
The metacharacter
The complete set of metacharacters include the following symbols:
|
The behavior of the language information function nl_langinfo()
is likewise affected by the values set for these environment variables (see also langinfo.h
).
LC_COLLATE
, LC_CTYPE
, LC_MONETARY
, LC_NUMERIC
and LC_TIME
are defined to accept an additional field @modifier, which allows the user to select a specific instance of localization data within a single category (for example, for selecting the dictionary as opposed to the character ordering of data). The syntax for these environment variables is thus defined as:
[
language[
_territory[.
codeset]][@
modifier]]
For example, if a user wants to interact with the system in French, but needs to sort German text files, LANG
and LC_COLLATE
could be defined as:
LANG=Fr_FR
LC_COLLATE=De_DE
This could be extended to select dictionary collation (for example) by use of the @modifier field:
LC_COLLATE=De_DE@dict
These values are linked to a program ́s locale at runtime by calling setlocale()
.