ibm-information-center/dist/eclipse/plugins/i5OS.ic.nls_5.4.0.1/rbagsixamplecreatelocale.htm

312 lines
23 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Example: Create a locale" />
<meta name="abstract" content="This example contains the steps necessary for creating a locale. The example also shows how to enable the locale." />
<meta name="description" content="This example contains the steps necessary for creating a locale. The example also shows how to enable the locale." />
<meta name="DC.Relation" scheme="URI" content="rbagslocaleprogexamp.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagslocale.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagssyssuplocalesourcedef.htm" />
<meta name="DC.Relation" scheme="URI" content="rbagslctimecategory.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbagsixamplecreatelocale" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example: Create a locale</title>
</head>
<body id="rbagsixamplecreatelocale"><a name="rbagsixamplecreatelocale"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Create a locale</h1>
<div><p>This example contains the steps necessary for creating a locale.
The example also shows how to enable the locale.</p>
<p>Steps for enabling the locale are:</p>
<ol><li>Create (or have ) a library and a source physical file.</li>
<li>Copy an existing locale source file definition member (to a library and
source physical file).</li>
<li>Edit the copied locale source file member if you need to customize any
of the categories within the locale source.</li>
<li>Create the locale object.</li>
<li>Enable the locale object by using system values or parameters on the user
profile.</li>
</ol>
<div class="section" xml:lang="en-us" id="rbagsixamplecreatelocale__createlibsourcephysicalfile"><a name="rbagsixamplecreatelocale__createlibsourcephysicalfile"><!-- --></a><h4 class="sectiontitle">Step 1.
Create a library and source physical file</h4><p>The
library and source physical file are needed to store the locale source file
member. The System-supplied locale source definition files topic includes
a list of the locale source file members that are included in i5/OS™.</p>
<ol><li>Type CRTLIB and press the F4 (prompt) key.</li>
<li>Type localelib for the name of the library and press the Enter key.</li>
</ol>
<p>There is now a library called localelib.</p>
<p>Next, create a source
physical file.</p>
<ol><li>Type CRTSRCPF and press the F4 (prompt) key.</li>
<li>Type localesrc for the file name and press the Enter key.</li>
</ol>
<p>There is now a source physical file (localesrc) created in library
localelib.</p>
</div>
<div class="section" xml:lang="en-us" id="rbagsixamplecreatelocale__copylocalesourcedefinit"><a name="rbagsixamplecreatelocale__copylocalesourcedefinit"><!-- --></a><h4 class="sectiontitle">Step 2. Copy
an existing locale source definition</h4><p>IBM-supplied locale source
definition file members are located in library QSYSLOCALE, source physical
file QLOCALESRC. See System-supplied locale source definition files for a
list of all IBM-supplied locale source files. In this example, member EN_US,
a locale for the English language, is copied.</p>
<ol><li>Type CPYF and press the F4 (prompt) key.</li>
<li>Type the values shown on the following display.<pre>+--------------------------------------------------------------------------------+
|Copy File (CPYF) |
| |
|Type choices, press Enter. |
| |
|From file . . . . . . . . . . . QLOCALESRC Name |
|Library . . . . . . . . . . . QSYSLOCALE Name, *LIBL,*CURLIB |
|To file . . . . . . . . . . . . LOCALESRC_ Name, *PRINT |
|Library . . . . . . . . . . . LOCALELIB_ Name, *LIBL,*CURLIB |
|From member . . . . . . . . . . EN_US Name, generic*,*FIRST, *ALL |
|To member or label . . . . . . . EN_US_____ Name, *FIRST,*FROMMBR |
|Replace or add records . . . . . *ADD____ *NONE, *ADD,*REPLACE |
|Create file . . . . . . . . . . *YES *NO, *YES |
|Record format field mapping . . *MAP__ *NONE, *NOCHK,*CVTSRC |
+--------------------------------------------------------------------------------+</pre>
<p>The values entered copy the EN_US member to the source physical
file localesrc in library localelib.</p>
<div class="note"><span class="notetitle">Note:</span> When you copy a file that is
tagged with a CCSID, you need to use the FMTOPT(*MAP) parameter to ensure
that the copied source is converted to the CCSID of the "to file". The FMTOPT
parameter can be seen by scrolling ahead.</div>
</li>
</ol>
</div>
<div class="section" xml:lang="en-us" id="rbagsixamplecreatelocale__editcopiedlocalesourcedef"><a name="rbagsixamplecreatelocale__editcopiedlocalesourcedef"><!-- --></a><h4 class="sectiontitle">Step 3. Edit
the copied locale source definition</h4><p>If you want to use the IBM-supplied
locale as it is included, you do not need to change it. You can go to the
next step, create the locale object. However, in this example we will edit
the EN_US member to set the time-of-day keywords used in the LC_TOD category.</p>
<div class="note"><span class="notetitle">Note:</span> The
LC_TOD category is included with the keywords having no values. See the LC_TOD
Category to view the LC_TOD source as included by IBM<sup>®</sup>.</div>
<p>In this example, Source Entry
Utility (SEU) is used to edit the locale. You can use SEU or an equivalent
editor.</p>
<ol><li>Type STRSEU (Start Source Entry Utility) and press the F4 (prompt) key.</li>
<li>Type the source file name (localesrc), library name (localelib), and source
member name (EN_US) as shown on the following display.<pre>+--------------------------------------------------------------------------------+
|Start Source Entry Utility (STRSEU) |
| |
|Type choices, press Enter. |
| |
|Source file . . . . . . . . . . localesrc Name, *PRV |
|Library . . . . . . . . . . . localelib_ Name, *LIBL, *CURLIB, *PRV |
|Source member . . . . . . . . . EN_US_____ Name, *PRV, *SELECT |
+--------------------------------------------------------------------------------+</pre>
</li>
<li>Press the Enter key. The following display appears:<pre>+--------------------------------------------------------------------------------+
|COLUMNS . . . : 1 71 <span class="uicontrol"> EDIT</span> LOCALELIB/LOCALESRC |
|SEU==&gt; <var class="varname">F_LC_TOD</var> EN_US |
|FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+...6 ...+... 7 |
|*************** BEGINNING OF DATA************************************* |
|5967.00 comment_char &lt;percent-sign&gt; |
|5968.00 escape_char &lt;slash&gt; |
|5969.00 |
|5970.00 % |
|5971.00 % 5716SS1 (C) COPYRIGHT IBM CORP. 1991,1996 |
|5972.00 % ALL RIGHTS RESERVED. |
|5973.00 % US GOVERNMENT USERS RESTRICTED RIGHTS - |
|5974.00 % USE, DUPLICATION OR DISCLOSURE RESTRICTED |
|5975.00 % BY GSA ADP SCHEDULE CONTRACT WITH IBM CORP. |
|5976.00 % |
|5977.00 % LICENSED MATERIALS-PROPERTY OF IBM |
|5978.00 % |
|5979.00 % FILE NAME : EN_US |
|5980.00 % |
|5981.00 % COUNTRY/REGION: UNITED STATES |
|5982.00 % |
| |
|F3=EXIT F4=PROMPT F5=REFRESH F9=RETRIEVE F10=CURSOR F11=TOGGLE |
|F16=REPEAT FIND F17=REPEAT CHANGE F24=MORE KEYS |
| <span class="uicontrol"> (C) COPYRIGHT IBM CORP.1981, 1996.</span> |
+--------------------------------------------------------------------------------+</pre>
</li>
<li>Use the SEU search function to locate LC_TOD. After the search completes,
the following display appears.<p>As you can see, all LC_TOD category
keywords have values of 0 and no descriptive names declared for tname and
dstname.</p>
<pre>+--------------------------------------------------------------------------------+
|COLUMNS . . . : 1 71 <span class="uicontrol"> EDIT</span> LOCALELIB/LOCALESRC |
|SEU==&gt; EN_US |
|FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+...6 ...+... 7 |
|6519.00 |
|<span class="uicontrol">6520.00</span> LC_TOD |
|6521.00 |
|6522.00 tzdiff 0 |
|6523.00 tname "" |
|6524.00 dstname "" |
|6525.00 dststart 0,0,0,0 |
|6526.00 dstend 0,0,0,0 |
|6527.00 dstshift 0 |
|6528.00 |
|6529.00 END LC_TOD |
|****************** END OF DATA**************************************** |
| |
| |
| |
| |
| |
| |
|F3=EXIT F4=PROMPT F5=REFRESH F9=RETRIEVE F10=CURSOR F11=TOGGLE |
|F16=REPEAT FIND F17=REPEAT CHANGE F24=MORE KEYS |
|<span class="uicontrol">STRING LC_TOD FOUND.</span> |
+--------------------------------------------------------------------------------+</pre>
</li>
<li>Type the following values for the LC_TOD keywords. If you need more detailed
information about this category, see LC_TOD Category. <dl><dt class="dlterm">tzdiff</dt>
<dd>Time zone difference in minutes. Type 360. This is the difference in the
number of minutes between Greenwich mean time and the central time zone of
the United States.</dd>
<dt class="dlterm">tname</dt>
<dd>Specifies the string used for the time zone name. Type "&lt;C&gt;&lt;E&gt;&lt;N&gt;&lt;T&gt;&lt;R&gt;&lt;A&gt;&lt;L&gt;".</dd>
<dt class="dlterm">dstname</dt>
<dd>The string used for the daylight saving time name. Type "&lt;C&gt;&lt;D&gt;&lt;T&gt;"
to mean Central Daylight Time.</dd>
<dt class="dlterm">dststart</dt>
<dd>Four integers representing the start date for daylight saving time. Type
4,0,23,0. This string of integers means that daylight saving time starts the
fourth month of the year, the twenty-third day of the month, and 0 seconds
after midnight local standard time.</dd>
<dt class="dlterm">dstend</dt>
<dd>Four integers representing the end date for daylight saving time. Type
10,3,6,0. This string of integers means that daylight saving time ends the
tenth month of the year, the beginning of the third week, the sixth day of
the week, and 0 seconds after midnight local standard time.</dd>
<dt class="dlterm">dstshift</dt>
<dd>An integer value representing the daylight saving time shift in seconds.
Type 3600.</dd>
</dl>
<p>The SEU edit screen should match the screen below.</p>
</li>
<li>Press the Enter key to make the changes to the EN_US locale member.<pre>+--------------------------------------------------------------------------------+
|COLUMNS . . . : 1 71 <span class="uicontrol"> EDIT</span> LOCALELIB/LOCALESRC |
|SEU==&gt; EN_US |
|FMT ** ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+...6 ...+... 7 |
|6519.00 |
|<span class="uicontrol">6520.00</span> LC_TOD |
|6521.00 |
|6522.00 tzdiff 360 |
|6523.00 tname "&lt;C&gt;&lt;E&gt;&lt;N&gt;&lt;T&gt;&lt;R&gt;&lt;A&gt;&lt;L&gt;" |
|6524.00 dstname "&lt;C&gt;&lt;D&gt;&lt;T&gt;" |
|6525.00 dststart 4,0,23,0 |
|6526.00 dstend 10,3,6,0 |
|6527.00 dstshift 3600 |
|6528.00 |
|6529.00 END LC_TOD |
|****************** END OF DATA **************************************** |
| |
| |
| |
| |
| |
| |
|F3=EXIT F4=PROMPT F5=REFRESH F9=RETRIEVE F10=CURSOR F11=TOGGLE |
|F16=REPEAT FIND F17=REPEAT CHANGE F24=MORE KEYS |
|<span class="uicontrol">STRING LC_TOD FOUND.</span> |
+--------------------------------------------------------------------------------+</pre>
</li>
<li>Save the member and exit SEU.</li>
</ol>
<p>You have now copied the IBM-supplied locale source member and customized
the LC_TOD category.</p>
</div>
<div class="section" xml:lang="en-us" id="rbagsixamplecreatelocale__createlocaleobject"><a name="rbagsixamplecreatelocale__createlocaleobject"><!-- --></a><h4 class="sectiontitle"> Step 4. Create the
locale object</h4><ol><li>Type CRTLOCALE on any command line and press the F4 (prompt) key. The
Create Locale (CRTLOCALE) screen appears.</li>
<li>Type the locale path name (path name includes the location of as well
as the name of the locale source member) in the locale name field.</li>
<li>Next, type the source file path name (location and name of the source
physical file and the member name) in the source file path name field.<div class="note"><span class="notetitle">Notes:</span> <ol type="a"><li>Make sure that the locale source file you are using has the same characters
defined as does the CCSID you specify on the CRTLOCALE command. If they do
not have the same characters available, unpredictable results can occur. For
example, the EN_US source file has lower case letters defined. However, the
lower case letters are not available in CCSID 290.</li>
<li>When creating locale objects, it is recommended to make the CCSID part
of the locale object name. For example, EN_US created with CCSID 37 can be
named EN_US37.</li>
</ol>
</div>
<pre>+--------------------------------------------------------------------------------+
|Create Locale (CRTLOCALE) |
| |
|Type choices, press Enter. |
| |
|Locale name . . . . . . . . . . &gt; '/qsys.lib/localelib.lib/en_us.locale'____ |
|______ |
|Source file path name . . . . . &gt; '/qsys.lib/localelib.lib/localesrc.file/en |
|_us.mbr' |
|Coded character set ID . . . . . &gt; 37________ 1-65533, *JOB |
|Generation severity level . . . 10____ 10, 20 |
|Text 'description' . . . . . . . my version of locale EN_US - contains my c |
|hanges_ |
| |
| |
| |
| |
| |
| |
| |
|Bottom |
|F3=Exit F4=Prompt F5=Refresh F10=Additional parameters F12=Cancel |
|F13=How to use this display F24=More keys |
| |
| |
+--------------------------------------------------------------------------------+</pre>
</li>
<li>Press the Enter key to complete the creation of the locale object named
EN_US in the library LOCALELIB</li>
</ol>
</div>
<div class="section" xml:lang="en-us" id="rbagsixamplecreatelocale__enablethelocaleobject"><a name="rbagsixamplecreatelocale__enablethelocaleobject"><!-- --></a><h4 class="sectiontitle">Step 5. Enable
the locale object</h4><p>Locales can be enabled system-wide using the QLOCALE
system value or for individual users by changing their user profile. To enable
system-wide, make EN_US the value for QLOCALE. In this example locale support
is enabled for one user.</p>
<ol><li>Type CHGUSRPRF and press the F4 (prompt) key.</li>
<li>Specify your userid and then press the Enter key.<p>In the following portion
of the Change User Profile display, the LOCALE parameter now has a value indicating
that EN_US is the specified locale to be used by your userid.</p>
<pre>+--------------------------------------------------------------------------------+
|+ for more values |
|Locale . . . . . . . . . . . . . QSYS.LIB/LOCALELIB.LIB/EN_US.LOCALE______ |
|_______ |
+--------------------------------------------------------------------------------+</pre>
</li>
</ol>
<p>After your user profile has been changed, any jobs initiated by your
userid have the EN_US locale associated with those jobs. The LANG environment
variable is also initialized to the name of the locale.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbagslocaleprogexamp.htm" title="In addition to the examples in this topic, The locale categories information provides programming examples for each of the different locale categories.">Examples: Locale programming</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbagslocale.htm" title="Locales are used primarily in ILE-based application programs. Additionally, the Retrieve Locale Information (OPM, QLGRTVLC; ILE, QlgRetrieveLocaleInformation) API retrieves one or all categories of a locale.">Work with locales</a></div>
<div><a href="rbagssyssuplocalesourcedef.htm" title="The system-supplied locale source definition file members are in the optionally installable library QSYSLOCALE in the QLOCALESRC source file. The source file members are encoded in CCSID 37 and are read only.">System-supplied locales and recommended CCSIDs</a></div>
<div><a href="rbagslctimecategory.htm" title="The LC_TIME category of a locale definition source file defines rules and symbols for formatting time and date information. This category begins with an LC_TIME category header and ends with an END LC_TIME category trailer.">LC_TIME category</a></div>
</div>
</div>
</body>
</html>