A program's active locale is set either implicitly at program startup, as described above, or explicitly by a call to setlocale(). The setlocale() function takes two arguments: an integer representing the locale category whose values are needed for the active locale, and the name of the locale from which the values are to be taken. The name of the locale can be any of the following:
When the locale argument of setlocale() is specified as a null string (""), setlocale() sets the active locale according to the environment variables defined for the job in which the program is running. You can create environment variables that have the same names as the locale categories and specify the locale to be associated with each environment variable. The LANG environment variable is automatically created during job initiation when you specify a locale path name for the LOCALE parameter in your user profile or for the QLOCALE system value.
When a program calls setlocale(category, ""), the locale-related environment variables defined in the current job are checked to find the locale name or names to be used for the specified category. The locale name is chosen according to the first of the following conditions that applies:
If the locale specified for the environment variable is found to be invalid or non-existent, setlocale() returns NULL and the program's active locale remains unchanged.
For setlocale(LC_ALL, ""), if the locale names found identify valid locales on the system, setlocale() returns a string naming the locale associated with each locale category. Otherwise, setlocale() returns NULL, and the program's locale remains unchanged.
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.