Using the localedef utility

The locale objects or locales are generated using the localedef utility. The localedef utility:
  1. Reads the locale definition file
  2. Resolves all the character symbolic names to the values of characters defined in the specified character set definition file, (CHARMAP)
  3. Produces a z/OS® XL C source file.
  4. Compiles the source file using the z/OS XL C compiler and link-edits the produced text module to produce a locale object. localedef produces ASCII locale objects as XPLINK DLL's exclusively, while EBCDIC locales can be non-XPLINK objects or XPLINK DLL's.
Note: AMODE 64 locales are always XPLINK locales, while 31-bit locales may be XPLINK or non-XPLINK.

The locale DLL object can be loaded by the setlocale() function and then accessed by the z/OS XL C/C++ functions that are sensitive to the cultural information, or that can query the locales. For a list of all the library functions sensitive to locale, see Locale-sensitive interfaces. For detailed information on how to invoke localedef, see localedef utility in the z/OS XL C/C++ User's Guide.

The locale DLL object created by localedef must adhere to certain naming conventions so that the locale can be used by the system. These conventions are outlined in Locale naming conventions.

XPLINK applications require XPLINK locale objects, and non-XPLINK applications require non-XPLINK locale objects. Likewise, AMODE 64 applications require AMODE 64 locale objects. localedef creates non-XPLINK locales by default. The option XPLINK causes the TSO localedef command (LOCALDEF) to produce an XPLINK locale object. The batch XPLINK localedef command (EDCXLDEF proc) produces an XPLINK locale object (while the batch localedef command (EDCLDEF) produces a non-XPLINK locale object). The -X parameter causes the UNIX System Services localedef command to generate an XPLINK locale object.

The TSO localedef (LOCALDEF) command and the batch XPLINK localdef command (EDCXLDEF proc) cannot be used to generate ASCII locales or AMODE 64 locales. Only the UNIX System Services localedef command may be used. ASCII locales are generated by specifying the -A localedef option on the command line of the UNIX System Services localedef command. AMODE 64 locales are generated by specifying the -6 option on the command line of the UNIX System Services localedef command. Specify both -A and -6 to produce locale objects which are both ASCII and AMODE 64. AMODE 64 locales are always XPLINK locales. The -X option is implicitly specified whenever the -6 option is specified. Users can supply functions for the methods referenced in the locale charmap category by indicating the -m method_file option on the command line.

The POSIX shell (/bin/sh) UNIX System Services shell, /bin/sh, is an example of a non-XPLINK application that uses locales. It needs non-XPLINK locales. If the shell invokes an XPLINK application that uses locales, the application will need an XPLINK version of the same locale. Usually, both XPLINK and non-XPLINK versions of a locale are needed whenever an XPLINK application is invoked from the shell, or when an XPLINK application invokes the shell or any other non-XPLINK application. Likewise, usually both AMODE 64 and non-XPLINK versions of a locale are needed whenever a AMODE 64 application is invoked from the shell, or when a AMODE 64 application invokes the shell or any other non-XPLINK application. The locale object naming conventions ensure that the runtime library loads the appropriate version of the locale.