Coded character set in source code and header files
There are five types of locale-related changes that you can make
in your source code:
- You can tag your source code and other associated files with the
#pragma filetagdirective to specify the coded character set that was used while entering the file. You can then compile these to ensure that all variant characters in your files are correct. - You can use the three macros: __LOCALE__,
__FILETAG__, and __CODESET__. These z/OS® XL C/C++ macros expand to provide information about the
#pragma filetagdirective of the current source, and the locale and target coded character set used by the compiler at compile time. For more information, see Compiler predefined macros in z/OS XL C/C++ Language Reference. - You can use the
setlocale()function to set the runtime locale to be the same as the locale used to compile the application. This can be used when your application contains dependencies on the coded character set, as it would when comparing constants with external data. Using the macros forces the runtime locale to be the same as the one used to compile your code. - You can use the
#pragma convlitsuspend and resume to exclude portions of your code from string literal conversion. See CONVLIT | NOCONVLIT in z/OS XL C/C++ User's Guide for more details on the compiler option and #pragma convlit in z/OS XL C/C++ Language Reference for more information on the pragma. - You can use the
#pragma convertdirective to specify the coded character set to use for converting string literals. See convert in z/OS XL C/C++ Language Reference for more information on this pragma.