SETLOCALE function
Syntax
SETLOCALE (category, value)
Description
In NLS mode, use the SETLOCALE function to enable or disable a locale for a specified category or change its setting.
category is one of the following tokens that are defined in the UVNLSLOC.H file:
- UVLC$ALL
- Sets or disables all categories as specified in value. value is the name of a locale, OFF, or DEFAULT. value can also be a dynamic array whose elements correspond to the categories.
- UVLC$TIME
- Sets or disables the Time category. value is the name of a locale, OFF, or DEFAULT.
- UVLC$NUMERIC
- Sets or disables the Numeric category. value is the name of a locale, OFF, or DEFAULT.
- UVLC$MONETARY
- Sets or disables the Monetary category. value is the name of a locale, OFF, or DEFAULT.
- UVLC$CTYPE
- Sets or disables the Ctype category. value is the name of a locale, OFF, or DEFAULT.
- UVLC$COLLATE
- Sets or disables the Collate category. value is the name of a locale, OFF, or DEFAULT.
- UVLC$SAVE
- Saves the current locale state, overwriting any previous saved locale. value is ignored.
- UVLC$RESTORE
- Restores the saved locale state. value is ignored.
value specifies either a dynamic array whose elements are separated by field marks or the string OFF. An array can have one or five elements:
- If the array has one element, all categories are set or not set to that value.
- If the array has five elements, it specifies the following values in this order: TIME, NUMERIC, MONETARY, CTYPE, and COLLATE.
The MD, MR, and ML conversions require both Numeric and Monetary categories to be set in order for locale information to be used.
The STATUS function returns 0 if SETLOCALE is successful, or one of the following error tokens if it fails:
- LCE$NO.LOCALES
- InfoSphere® DataStage® locales are disabled.
- LCE$BAD.LOCALE
- value is not the name of a locale that is currently loaded, or the string OFF.
- LCE$BAD.CATEGORY
- You specified an invalid category.
- LCE$NULL.LOCALE
- value has more than one field and a category is missing.
The error tokens are defined in the UVNLSLOC.H file.
Examples
The following example sets all the categories in the locale to FR-FRENCH:
status = SETLOCALE(UVLC$ALL,"FR-FRENCH")
The next example saves the current locale. This is the equivalent of executing the SAVE.LOCALE command.
status = SETLOCALE(UVLC$SAVE,"")
The next example sets the Monetary category to DE-GERMAN:
status = SETLOCALE(UVLC$MONETARY,"DE-GERMAN")
The next example disables the Monetary category. InfoSphere DataStage behaves as though there were no locales for the Monetary category only.
status = SETLOCALE(UVLC$MONETARY,"OFF")
The next example completely disables locale support for all categories:
status = SETLOCALE(UVLC$ALL,"OFF")
The next example restores the locale setting saved earlier:
status = SETLOCALE(UVLC$RESTORE,"")