LOCALE | NOLOCALE
Category
Object code control
Pragma equivalent
None.
Purpose
Specifies the locale to be used by the compiler as the current locale throughout the compilation unit.
With the LOCALE compiler option, you can specify the locale you want to use.
When the NOLOCALE compiler option is in effect, the compiler uses the default code page, which is IBM-1047.
Syntax
Defaults
NOLOCALE
For the z/OS® UNIX System
Services invocation utilities, the default is LOCALE(POSIX). The utilities
pick up the locale value of the environment using setlocale(LC_ALL,NULL))
.
Because the compiler runs with the POSIX(OFF) option, categories that
are set to C are changed to POSIX.
Parameters
- name
- Indicates the name of the locale to be used by the compiler at compile time. If you omit name, the compiler uses the current default locale in the environment. If name does not represent a valid locale name, a warning message is emitted and NOLOCALE is used.
Usage
You can specify LOCALE on the command line or in the PARMS list in the JCL.
If you specify the LOCALE option, the locale name and the associated code set appear in the header of the listing. A locale name is also generated in the object module.
The LC_TIME category of the current locale controls the format of the time and the date in the compiler-generated listing file. The identifiers that appear in the tables in the listing file are sorted as specified by the LC_COLLATE category of the locale specified in the option.
The usage status of this option is inserted in the object file to aid you in diagnosing a problem with your program.
IPA effects
The LOCALE option controls processing only for the IPA step for which you specify it.
During the IPA compile step, the compiler converts source code using the code page that is associated with the locale specified by the LOCALE compile-time option. As with non-IPA compilations, the conversion applies to identifiers, literals, and listings. The locale that you specify on the IPA compile step is recorded in the IPA object file.
You should use the same code page for IPA compile step processing for all of your program source files. This code page should match the code page of the runtime environment. Otherwise, your application may not run correctly.
- The encoding of the message text and the listing text.
- Date and time formatting in the Source File Map section of the listing and in the text in the object comment string that records the date and time of IPA link step processing.
- Sorting of identifiers in listings. The IPA link step uses the sort order associated with the locale for the lists of symbols in the Inline Report (Summary), Global Symbols Map, and Partition Map listing sections.
If the code page you used for a compilation unit for the IPA compile step does not match the code page you used for the IPA link step, the IPA link step issues an informational message.
- The Prolog section of the listing displays the LOCALE or NOLOCALE option. If you specified the LOCALE option, the Prolog displays the locale and code set that are in effect.
- The Compiler Options Map listing section displays the LOCALE option active on the IPA compile step for each IPA object. If you specified conflicting code sets between the IPA Compile and IPA link steps, the listing includes a warning message after each Compiler Options Map entry that displays a conflict.
- The Partition Map listing section shows the current LOCALE option.
Predefined macros
- __CODESET__ is defined to the name of the compile-time code set.
The compiler uses the runtime function
nl_langinfo(CODESET)
to determine the name of the compile-time code set. If you do not use the LOCALE compile option, the macro is undefined. - __LOCALE__ is defined to the name of the compile-time locale.
If you specified LOCALE(string literal), the compiler uses the runtime
function
setlocale(LC_ALL,"string literal")
to determine the name of the compile-time locale. If you do not use the LOCALE compile option, the macro is undefined.
Related information
For more information on Customizing a locale, refer to z/OS XL C/C++ Programming Guide.