Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Locale

&pagelevel(3)&pagelevel

The locale is a subset of the settings for the runtime environment. It affects the behavior of C programs with respect to country-specific conventions, norms and languages. The locale consists of one or more categories. The following categories are supported in XPG4 Version 2-conformant environments:

LC_ALL

LC_COLLATE

Determines all values of the current locale.

Determines the collating sequence of characters. Each character is defined
in relation to another by means of a weight. This affects the behavior of the
strcoll() and strxfrm().

The name of the corresponding definition file in the POSIX subsystem is
/usr/lib/locale/locale/LC_COLLATE.

The corresponding table in BS2000 is named COLL/uscol.

LC_CTYPE

Determines character classification (i.e. the assignment of characters to
character classes), case conversion (i.e. the association between
uppercase and lowercase letters) and other character attributes.

The name of the corresponding definition file in the POSIX subsystem is
/usr/lib/locale/locale/LC_CTYPE.

There are 3 tables in BS2000 for all EBCDIC characters:

The classification table TYPE/ustyp assigns each EBCDIC character to a
particular character class. The classes are represented by the following values:

Character class

Assembler code

C code

Uppercase letter (upper)

X'01'

_U

Lowercase letter (lower)

X'02'

_L

Decimal digit (digit)

X'04'

_N

White space (space)

X'08'

_S

Punctuation character
(punct)

X'10'

_P

Control character (cntrl)

X'20'

_C

Hexadecimal character
(xdigit)

X'40'

_X

The C values are defined in the header file ctype.h.

The tables for converting uppercase letters to lowercase (LOWER/uslow)
and lowercase letters to uppercase (UPPER/usupp) indicate the character
obtained from the conversion of each character from X’00’ to X’FF’.

These tables are used by the macros toupper() and tolower() for
converting to uppercase and lowercase letters, respectively. The table
needs to be filled only for characters which are classified as uppercase or lowercase letters in the classification table.

LC_MESSAGES Determines the format of messages.

The name of the corresponding definition file in the POSIX subsystem is/usr/lib/locale/locale/LC_MESSAGES.

This category is not supported by the BS2000 functionality.

LC_MONETARY Determines the formats of monetary values.


The name of the corresponding definition file in the POSIX subsystem is
/usr/lib/locale/locale/LC_MONETARY.

LC_NUMERIC

Determines the representation of non-monetary numeric values for
formatted I/O (fprintf(), fscanf()), the conversion of strings (atof(),
strtod()), and the values returned by localeconv().

The name of the corresponding definition file in the POSIX subsystem is
/usr/lib/locale/locale/LC_NUMERIC.

LC_TIME

Determines the date and time representation for calls to strfmon().

The name of the corresponding definition file in the POSIX subsystem is
/usr/lib/locale/locale/LC_TIME.

These locale categories are also defined as environment variables.

The behavior of XPG4 Version 2-conformant commands (e.g. the POSIX commands) is affected by the current locale (see section “Environment variables” and the manual "POSIX Commands" [2 (Related publications)]). The C library functions setlocale() and localeconv() may be used to change the current locale of a C program at runtime.
The following C library functions are directly affected by the current locale:

atof()

isalnum()

isalpha()

isascii()

iscntrl()

isdigit()

isgraph()

islower()

isprint()

ispunct()

isspace()

isupper()

isxdigit()

localeconv()

setlocale()

strcoll()

strftime()

strtod()

strxfrm()

tolower()

toupper()

wctomb()

wcstombs()



The C runtime library provides some predefined locales (see the section “Predefinedlocales”). However, users may also define their own locales (see section“Userspecific locales” (User-specific locales)).

CRTE provides the predefined locales De.EDF04F and De.EDF04F@euro to support the Euro. These two locales differ only by the category LC_MONETARY that represents the German mark (DM) for the locale De.EDF04F and the Euro for the locale De.EDF04F@euro.

When the value of a locale environment variable begins with a slash (/), it is interpreted as the pathname of the locale definition.

Applications can change the current locale, i.e. set some other predefined locale by invoking setlocale() with the appropriate value. If the function is called with an empty string for locale, then the value of the environment variable that was specified using the category argument is evaluated:

setlocale(LC_ALL, "");

In this case all categories are determined by the corresponding environment variables. If the environment variable is unset or is set to an empty string, the environment is evaluated (see also section “Environment variables”).