Customizing a locale
This topic describes how you can create your own locales, based on the locale definition files supplied by IBM. The information in this topic applies to the format of locales based on the localedef utility.
The following example assumes that the target of the generated locale will be a data set, but locales may also reside in a z/OS® UNIX file system (see Locale naming conventions for differences in object
names). In this example you will build a locale named TEXAN using
the charmap file representing the IBM-1047 encoded character set. The locale is derived from the locale representing the English language and the cultural conventions of the United States. We will assume that non-XPLINK, XPLINK, and AMODE 64 applications will use the TEXAN locale.
All three versions of the TEXAN locale will be generated.
- Determine the source of the locale you are going to use. In
this case, it is the English language in the United States locale, the source for which is the
member
EDC$EUEYof the PDS CEE.SCEELOCX. - Copy the member
EDC$EUEYfrom PDS CEE.SCEELOCX to the data set hlq.LOCALE.SOURCE which has been pre-allocated with the same attributes as CEE.SCEELOCX. - In your new file, change the locale variables to the desired values.
For example, change
d_t_fmt "%a %b %e %H:%M:%S %Z %Yto
d_t_fmt "Howdy Pardner %a %b %e %H:%M:%S %Z %Y" - This locale's Language-Territory value
is
TEXAN. The Codeset value is IBM-1047.TEXANis not a valid PDS resident locale name in the runtime library, because it does not appear in the runtime Locale Name Table. You must modify the table to include theTEXANlocale. Here are the steps to follow.- Copy the member
EDC$LCNMfrom PDS CEE.SCEESAMP to the data set hlq.LOCALE.TABLE which has been pre-allocated with the same attributes as CEE.SCEESAMP. The z/OS XL C/C++ Library uses this table to map locale code registry prefixes into two-character codes. - For this example, insert a new line into the assembler table before
the last
EDCLOCNM TYPE=ENDentry:EDCLOCNM TYPE=ENTRY,LOCALE='TEXAN',CODESET='IBM-1047',CODE='1T'
- Copy the member
- Now that your locale name table has been modified, you must make
it available to the system. Assemble the
EDC$LCNMmember and link-edit it into the hlq.LOCALE.LOADLIB load library with the member nameEDC$LCNM. For our example, this is done as follows://HLASM EXEC PGM=ASMA90 //SYSPRINT DD SYSOUT=* //SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR // DD DSN=CEE.SCEEMAC,DISP=SHR //SYSUT1 DD UNIT=VIO,DISP=(NEW,DELETE),SPACE=(32000,(30,30)) //SYSUT2 DD UNIT=VIO,DISP=(NEW,DELETE),SPACE=(32000,(30,30)) //SYSUT3 DD UNIT=VIO,DISP=(NEW,DELETE),SPACE=(32000,(30,30)) //SYSPUNCH DD DUMMY //SYSLIN DD DSN=<hlq>.LOCALE.OBJECT(EDC$LCNM),DISP=SHR //SYSIN DD DSN=<hlq>.LOCALE.TABLE(EDC$LCNM),DISP=SHR //* //LKED EXEC EDCL, // OUTFILE='<hlq>.LOCALE.LOADLIB(EDC$LCNM),DISP=SHR' //LKED.SYSLIN DD DSN=<hlq>.LOCALE.OBJECT(EDC$LCNM),DISP=SHR - Generate the non-XPLINK, XPLINKand 64–bit locale objects into a load library.
Note that both the XPLINK and 64–bit locale
objects must be placed in a PDSE, while non-XPLINK locale objects may be in either a PDS or PDSE
load library.
- Determine the correct locale object names, using the locale naming Conventions outlined in Locale naming conventions. PDS resident locale object names are of the form
prefixLTCC.For this non-XPLINK locale the
prefixisEDC$, theLTcode forTEXANis1Tand theCCcode for IBM-1047 isEY. The non-XPLINK object name is thereforeEDC$1TEY.For this XPLINK locale the
prefixisCEH$. TheLTandCCcodes remain the same. TheXPLINKobject name is thereforeCEH$1TEY.For this 64–bit locale the
prefixis CEQ$. TheLTandCCcodes remain the same. The 64–bit locale object name is, therefore,CEQ$1TEY. - Use localedef to generate the locale
objects.
- For non-XPLINK:
//GENLOCNX EXEC PROC=EDCLDEF, // INFILE='hlq.LOCALE.SOURCE(TEXAN)', // OUTFILE='hlq.LOCALE.LOADLIB(EDC$1TEY),DISP=SHR', // LOPT='CHARMAP(IBM-1047)' - For XPLINK:
//GENLOCX EXEC PROC=EDCXLDEF, // INFILE='hlq.LOCALE.SOURCE(TEXAN)', // OUTFILE='hlq.LOCALE.PDSE.LOADLIB(CEH$1TEY),DISP=SHR', // LOPT='CHARMAP(IBM-1047)' - For 64–bit
The batch and TSO versions of the localedef utility cannot be used to generate 64–bit locales. The UNIX Systems Services utility must be used. To do this from TSO or batch the
BPXBATCHutility can be used. See z/OS UNIX System Services Command Reference for more information aboutBPXBATCH. Here, we will assume we are in a UNIX System Services shell session:cp "//'hlq.LOCALE.SOURCE(TEXAN)'" texan.localedef localedef -6 -i texan.localedef -f /usr/lib/nls/charmap/IBM-1047 TEXAN.IBM-1047.lp64 cp TEXAN.IBM-1047.lp64 "//'hlq.LOCALE.PDSE.LOADLIB(CEQ$1TEY)'"
- For non-XPLINK:
See z/OS XL C/C++ User's Guide for detailed information about the batch and TSO versions of localedef utility. The UNIX System Services version of the localedef utility is also described in z/OS UNIX System Services Command Reference.
Note: TheTEXANlocale uses one of the IBM supplied CHARMAPs. If you need to customize a CHARMAP, then you must define its two-letterCCcode in the Codeset Name tableEDCUCSNM. This is similar to defining the localeTEXANinEDC$LCNM. The two-letter CHARMAP codes beginning with a number are reserved for customer use. This is the same as the convention for customer-supplied Locale NameLTcodes in the Locale Name table. TheCCportion of your locale object names would then change to be the newCCvalue you added to the Codeset Name table. - Determine the correct locale object names, using the locale naming Conventions outlined in Locale naming conventions. PDS resident locale object names are of the form