+ All Categories
Home > Documents > Rocket UniData International Reference Version...

Rocket UniData International Reference Version...

Date post: 09-May-2018
Category:
Upload: nguyenngoc
View: 240 times
Download: 1 times
Share this document with a friend
43
Rocket UniData International Reference Version 8.2.1 July 2017 UDT-821-UDTI-1
Transcript

Rocket UniData

International Reference

Version 8.2.1

July 2017UDT-821-UDTI-1

2

NoticesEdition

Publication date: July 2017Book number: UDT-821-UDTI-1Product version: Version 8.2.1

Copyright© Rocket Software, Inc. or its affiliates 1985-2017. All Rights Reserved.

Trademarks

Rocket is a registered trademark of Rocket Software, Inc. For a list of Rocket registered trademarks goto: www.rocketsoftware.com/about/legal. All other products or services mentioned in this documentmay be covered by the trademarks, service marks, or product names of their respective owners.

Examples

This information might contain examples of data and reports. The examples include the names ofindividuals, companies, brands, and products. All of these names are fictitious and any similarity tothe names and addresses used by an actual business enterprise is entirely coincidental.

License agreement

This software and the associated documentation are proprietary and confidential to Rocket Software,Inc. or its affiliates, are furnished under license, and may be used and copied only in accordance withthe terms of such license.

Note: This product may contain encryption technology. Many countries prohibit or restrict theuse, import, or export of encryption technologies, and current use, import, and export regulationsshould be followed when exporting this product.

3

Corporate informationRocket Software, Inc. develops enterprise infrastructure products in four key areas: storage, networks,and compliance; database servers and tools; business information and analytics; and applicationdevelopment, integration, and modernization.

Website: www.rocketsoftware.com

Rocket Global Headquarters77 4th Avenue, Suite 100Waltham, MA 02451-1468USA

To contact Rocket Software by telephone for any reason, including obtaining pre-sales informationand technical support, use one of the following telephone numbers.

Country Toll-free telephone number

United States 1-855-577-4323Australia 1-800-823-405Belgium 0800-266-65Canada 1-855-577-4323China 400-120-9242France 08-05-08-05-62Germany 0800-180-0882Italy 800-878-295Japan 0800-170-5464Netherlands 0-800-022-2961New Zealand 0800-003210South Africa 0-800-980-818United Kingdom 0800-520-0439

Contacting Technical Support

The Rocket Community is the primary method of obtaining support. If you have current support andmaintenance agreements with Rocket Software, you can access the Rocket Community and reporta problem, download an update, or read answers to FAQs. To log in to the Rocket Community or torequest a Rocket Community account, go to www.rocketsoftware.com/support.

In addition to using the Rocket Community to obtain support, you can use one of the telephonenumbers that are listed above or send an email to [email protected].

4

Contents

Notices................................................................................................................................................................................... 2

Corporate information......................................................................................................................................................... 3

Chapter 1: Introduction to UniData International..............................................................................................................6What is Internationalization?...................................................................................................................................6What UniData International provides..................................................................................................................... 6Language groups...................................................................................................................................................... 6

Language group ID....................................................................................................................................... 7UniBasic programming.................................................................................................................................8Date, numeric, and currency formats......................................................................................................... 8

Language message files........................................................................................................................................... 8Language message default record.............................................................................................................. 9Customization............................................................................................................................................... 9

General rules............................................................................................................................................................. 9Definitions, acronyms, abbreviations......................................................................................................................9

Chapter 2: Language configuration...................................................................................................................................11Starting UniData in a language group.................................................................................................................. 11

Chapter 3: Customizing UniData International................................................................................................................ 15Editing the DEFAULTS record................................................................................................................................ 15Adding a language to a language group...............................................................................................................16Starting UniData SQL in a local language............................................................................................................ 18UDT.OPTIONS 53 U_PMOD_THROWAWAY............................................................................................................ 18

ON................................................................................................................................................................ 19OFF............................................................................................................................................................... 19

Using menus to translate VOC keywords..............................................................................................................19Sorting order........................................................................................................................................................... 20

Adding a record to the COLLATIONS file.................................................................................................. 20Pointing to a new record in the language message file...........................................................................22

Chapter 4: Commands reference.......................................................................................................................................23DATE.FORMAT..........................................................................................................................................................23LIST.LANGGRP......................................................................................................................................................... 24SET.LANG................................................................................................................................................................. 25SET.MONEY.............................................................................................................................................................. 26SET.DEC................................................................................................................................................................... 27SET.THOUS.............................................................................................................................................................. 28UPDATE.LANG.DEFAULTS....................................................................................................................................... 29convmark.................................................................................................................................................................30

Chapter 5: Multibyte language reference......................................................................................................................... 32Limitations and exclusions.................................................................................................................................... 32Storing characters.................................................................................................................................................. 32Displaying characters............................................................................................................................................. 32Multibyte configuration file....................................................................................................................................33Adding a multibyte language to UniData............................................................................................................. 33UniBasic multibyte support................................................................................................................................... 36

Modified functions and commands...........................................................................................................36Singlebyte functions...................................................................................................................................37Multibyte functions.....................................................................................................................................38

BYTELEN.................................................................................................................................................................. 38CHARLEN..................................................................................................................................................................38DISPLAYWIDTH........................................................................................................................................................ 39

Contents

5

ISMB......................................................................................................................................................................... 39LEN........................................................................................................................................................................... 40MBLEN......................................................................................................................................................................40

Appendix A: UniData and UNIX locale...............................................................................................................................41Locale environment variables............................................................................................................................... 42

6

Chapter 1: Introduction to UniData InternationalThis manual describes what Rocket UniData provides for internationalization and localization.Applications developed in this environment enable the end user to input and display informationin the local language. Information in this manual is provided in English because the system ordatabase administrator who is configuring and using UniData must do so in English. Use this manualin conjunction with Using UniData and the UniData Commands Reference.

What is Internationalization?The demand for new computer technology worldwide is increasing, and in order to be accessibleto a wider audience of users, software developers have found a need to adapt products to differentlanguages. UniData has answered this need by broadening our database product to handle a variety oflanguages and regional conventions.

A vital part of internationalization is localization, the process of providing language-specific andregion-specific information. This means that a French user is able to input and display data in Frenchand receive error messages in French. Internationalization may also customize the UniData display oftime, date, and monetary signs.

What UniData International providesUniData International enables you to start UniData in your local language after you install UniData.When you start UniData in your language, it provides the following:

▪ Language groups — allows for storage of characters that can be translated to the appropriatelanguage by the terminal emulator client.

▪ Localized language message files — stores messages that can be translated to the appropriatelanguage by the user’s terminal emulator client.

▪ Time, date, numbers, and monetary sign — UniData automatically honors default conventions fordate, numbers, and currency.

▪ Customization — allows you to customize defaults and to translate keywords and commands.

UniData relies on the host operating system to provide National Language Support (NLS). However,if ported to an operating system that does not support internationalization, UniData is still ableto perform limited internationalization functions such as allowing the user to customize regionalinformation in the MSG.DEFAULTS file and to localize UniData messages.

Note: To take full advantage of UniData International, the underlying operating system mustconform to the Portable Operating System Interface (POSIX) specification in terms of LOCALEsupport. See UniData and UNIX locale, on page 41 and your host documentation for furtherinformation.

Language groupsLanguage groups are UniData’s way of separating languages into divisions. UniData reserves the useof certain delimiters as record marks. French and Japanese are part of UniData Language Group 2,although the languages are very different. This is because UniData is able to use the same delimitersfor both languages.

The UniData delimiters are described in the following table.

Language group ID

7

Delimiter symbol @variables Group 1 ASCIIvalue

Group 2 ASCIIvalue

Meaning

0 0 0 0 Escape sequencemark.

Print @ N/A 192 130 Device controlfunction forUniBasic output.

(white space) N/A 129 129 Mark reservedfor the NULLvalue. For moreinformation onNULL value, seeUsing UniData.

Remove 1 N/A 249 153 Used by UniBasicREMOVEstatements.

Remove 2 N/A 250 154 Used by UniBasicREMOVEstatements.

  { @TM 251 155 Text Mark| @SM 252 156 Subvalue Mark} @VM 253 157 Value Mark  ~ @FM 254 158 Field Mark(unprintable) @RM 255 159 Record Mark

Note: English is included in all language groups, because it is commonly used as a business andtechnical language. The UniData language name is English_G2 in Group 2, to distinguish it fromEnglish in Group 1.

Language group ID

Seven of the nine UniData delimiters have consecutive decimal values. The escape sequence markis any unused character in a code page. A language group is identified by the record mark (@RM),print-at character (@PRINT_AT) and the NULL character. These values are separated by a slash (forexample, 255/192/129 for Language Group 1, and 159/130/129 for Language Group 2).

UniData does not support conversion of characters to printable characters. These are charactersCHAR(32) through CHAR(127).

The record mark (@RM) you specify as the first delimited value in the language group determinesthe six consecutive characters preceding the character representing the record mark which UniDatareserves for use, along with the specified record mark,.The other six characters represent the fieldmark (@FM), the value mark (@VM), the subvalue mark (@SM), the text mark (@TM), and twocharacters which UniBasic uses in the REMOVE statement. You should take this into considerationwhen creating a language group. Values for the print-at (@PRINT_AT) character and the NULLcharacter should not overlap with the seven reserved characters determined by the character youspecify as the record mark.

Group # udtlang name Language group ID

Group 1 English (US, UK) 255/192/129

Chapter 1: Introduction to UniData International

8

Group # udtlang name Language group ID

Group 2 Some Multi-byte languagesJapanese (EUC) French(ISO8859-1) English_G2 (English)

159/130/129

Group 3 Simplified Chinese English_G3 20/31/30

UniBasic programming

Part of the UniData internationalization process is taking the ASCII values out of the program codeand replacing them with the corresponding @variables listed above. In any UniBasic programs usethe @variables for record marks rather than the ASCII values, so that the marks can be converted toanother language group. The @variables are runtime values, so they will return correct informationregardless of the language in which you run UniData.

Example

The following line of a BASIC program assigns an ASCII value for the value mark:

EQU VM TO CHAR/253

In UniBasic, this line should be written as follows:

EQU VM TO @VM

Date, numeric, and currency formats

Different countries use different conventions to display time, date, numbers, and monetary signs.UniData International provides defaults for these conventions, which you can change individuallyusing ECL commands.

To change any of these default formats during an individual session, see the section on ECLcommands in Customizing UniData International, on page 15. UniData uses the following defaults.

  English French Japanese

Date MM/DD/YY DD/MM/YY YYYY/MM/DDNumeric 999,999.00 999.99,00 999,999Currency $9,999.00 F9.999,00 ¥9,999

Note: If UniData is started in English, and you change the language to French using SET.LANG,UniData will run in French until the end of that UniData session. When you exit the UniDatasession and start another UniData session, UniData starts in the language defined by the LANGenvironment variable set at the operating system level.

Language message filesUniData stores message files for each language in the directory udthome/sys (for example,udthome/sys/FRENCH.MSG) on UniData for UNIX, or udthome\sys on UniData for WindowsPlatforms. These files contain the error messages for UniData, plus the DEFAULTS record for region-specific data. UniData uses the message file appropriate to the language of your UniData session.

Language message default record

9

Language message default record

Within each language message file is the DEFAULTS record. This record contains region-specific datathat you can configure. UniData reads this information when you start a session. The specifications inthis record take priority over the operating system locale categories. The example shows the actualFRENCH.MSG DEFAULTS record.

If you want to change any of the default information, see Editing the DEFAULTS record, on page 15.

.},}$}1DIMANCHE}LUNDI}MARDI}MERCREDI}JEUDI}VENDREDI}SAMEDIJAN}FEV}MAR}AVR}MAI}JUN}JLT}AOU}SEP}OCT}NOV}DECPRINTEMPS}ETE}AUTOMNE}HIVERY}N}QEND~~..“/tmp/__ED15319” 7 lines, 147 characters

If the DEFAULTS record contains no information for a language, UniData uses the operating systemdefaults.

Error messages

UniData International stores error messages in the language message files. Each language has errormessages translated into that language.

Customization

You can customize the DEFAULTS, which contains the days of the week and names of months, and soforth.

You can also customize ECL commands and keywords into language-specific synonyms. SeeCustomizing UniData International, on page 15 to learn how to customize default records,keywords, and commands.

General rulesThe following is a list of provisions to keep in mind when using UniData International:

▪ You must stop and restart UniData in order to switch language groups.

▪ You can change from one language to another language in the same language group during aUniData session.

Definitions, acronyms, abbreviationsThe following terms and concepts are used throughout this manual.

Term Definition

character set A set of alphabetic and other characters used to construct the words andother elementary units of a natural language.

Chapter 1: Introduction to UniData International

10

Term Definition

CJK writing system An ideographical character-based writing system. It is named after thethree languages, Chinese, Japanese and Korean, that use this writingsystem.

code page A mapping of 256 control and display characters. ASCII and EBCDIC aretwo common examples of code pages. ISO8859-1 (also known as Latin-1)is another.

double-byte character A 16-bit representation or encoding of a character.ECL - EnvironmentControl Language

The UniData Environment Control Language; provides the commandsnecessary to build and maintain a database.

EUC Extended UNIX Code. Provides operating system support for multibytecharacter sets; single byte and multibyte characters can be mixed.

ISO International Standards Organization.I18N Industry standard, abbreviated English reference to internationalization.

There are 18 letters between “i” and “n” in the word internationalization.language group The UniData language categorization. UniData requires nine 8-bit codes

for special use. All languages in the same group use the same codes fromtheir code page as UniData delimiters.

NLS—National LanguageSupport or NativeLanguage Support

NLS is part of the host operating system that provides internationalsupport with tools and libraries to internationalize applications.

single byte character An 8-bit encoding or representation of a character.UniBasic The UniData application programming language.UniData SQL The UniData extended implementation of the SQL (Structured Query

Language).VOC Abbreviated reference to the vocabulary file. When you create a UniData

file, UniData creates an entry in the VOC file, with the exception ofindexed files.

 

11

Chapter 2: Language configurationUniData installs in English and must be configured to run in another language. This chapter explainshow to use the language configuration script to change language groups and start UniData ina different language. The concept of language groups is important here. UniData reserves ninedelimiters as record marks, and languages that share the same set of delimiters can be classified inthe same language group. For instance, French and Japanese are part of UniData Language Group 2,although the languages are very different.

English is included in all language groups, because it is commonly used as a business and technicallanguage. The UniData language name is “English_G2” in Group 2. In Group 1 it is simply “English.”

Language groups are discussed in detail in Language groups, on page 6.

Before beginning the UniData language configuration, you:

▪ Must have root privileges on UniData for UNIX for Administrator privileges on UniData for WindowsPlatforms

▪ Should have some knowledge of locale concepts

Starting UniData in a language groupSince UniData installs in Language Group 1, which includes only American and British English, youneed to run the configuration script if you want to run UniData in another language. French andJapanese are currently supported, and are both in Language Group 2.

Note: You do not need to run the configuration if you always operate in English. You should runit only once if you will use only one of the languages in Language Group 2. For instance, if you useUniData in Japanese, French, or English, you never need to change back to Language Group 1,which includes only English. You can change languages within the same language group at anytime. See SET.LANG, on page 25 for more information.

To start UniData in a different language group, you must be a superuser (root) on UniData for UNIXor Administrator on UniData for Windows Platforms.

Follow these steps to change the language group and start UniData:

1. Check for users.Users must be logged off UniData, so you can stop all UniData processes. Enter the listusercommand. If there are users listed on the system have them log off now. If there are no currentusers, you can proceed.# listuserLicensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total( 32 + 32 ) / 64 0 0 0 0 0UDTNO USRNBR UID USRNAME USRTYPE TTY IP-ADDRESS TIME DATE

2. Stop Unidata.You must stop UniData before you can execute the language configuration script. From the udtbindirectory, execute ./stopud.# ./stopudUsing UDTBIN=/disk1/ud82/binSM stopped successfully.CLEANUPD stopped successfully.SBCS stopped successfully.SMM stopped successfully.Unidata R8.2.1 has been shut down.

Chapter 2: Language configuration

12

#

3. Verify LANG settings.The language environment variable, LANG, must be set to the same language that you will use tostart UniData. Since you are probably working with other internationalized software, LANG mayalready be set correctly. The LANG setting is based on locale.

Note: See UniData and UNIX locale, on page 41 for more information on UniData andlocale. See your host system documentation for specific information.

If your system is running in your local language, LANG is probably already set correctly. The “C” inLANG=C in the following example stands for English and is the default value on most platforms,according to the International Standards Organization’s “C” specifications. Check your currentenvironment for the LANG setting.

4. Set the LANG environment variable.If your LANG environment variable is not set correctly, use the appropriate command (such assetenv on UniData for UNIX) to change it. You do not need to use the entire locale name. Forinstance, in the locale list, French is listed as fr_FR.iso88519. You can use simply fr_FR.The following example, taken from UniData for UNIX, changes the LANG environment variable inthe Bourne or Korn shell:

$ LANG=fr_FR; export LANG$ LANG=Ja_JP; export LANG

To set the LANG environment variable on UniData for Windows Platforms, from the Start menu,click Control Panel, then double-click System.Click Advanced system settings, press tab, then click Environment Variables. The EnvironmentVariables dialog box appears. Under System variables, click New. In the Variable name box,enter LANG. In the Variable value box, enter the language group.

5. Execute the udtlangconfig script.The udtlangconfig script completes the following tasks:▪ Changes the language group from one language group to another.

▪ Converts existing data using the convmark command. This checks and converts the files inudthome/sys and udthome/demo on UniData for UNIX and udthome\sys and udthome\demo directories for the special system delimiters reserved for UniData. (Convert your owndata files with the convmark command, described later in this chapter.)

▪ Starts UniData in the language you specify.

Note: Language group numbers correspond to the record mark value (@RM), print at value(@PRINT_AT), and the null value.

From the system-level prompt, enter udtlangconfig to access the UniData language configurationscript. This configuration script prompts you for the information needed to start UniData in yourlocal language.

The next example shows the entire udtlangconfig process. The text shown in bold type indicatesthe information you have to enter. In the section that prompts you to enter the language, UniDatasets the default to match the LANG setting in your operating system. In this example, the LANG isset for French.

Starting UniData in a language group

13

Note: You must be superuser (root) on UniData for UNIX or Administrator on UniData forWindows Platforms, and be in the udtbin directory to execute udtlangconfig.

# udtlangconfigStarting configuration of UniData RDBMS system.The following prompts have the default answers in brackets [],press Enter to accept these answers.Using UDTBIN=/disk1/ud82/binWARNING: 'stopud -f' will stop the Unidata System with force.This may not guarantee the consistency of the database files.Would you like to continue?(y/n) [n]ySM stopped successfully.CLEANUPD stopped successfully.SMM stopped successfully.SBCS stopped successfully.Unidata R8.2.1 has been shut down.Please select the appropriate language from the list below:Language Locale------------------------------ENGLISH CENGLISH en_USENGLISH en_US.UTF-8ENGLISH_G2 CENGLISH_G2 en_USENGLISH_G2 en_US.UTF-8JAPANESE jaFRENCH frENGLISH_G3 CENGLISH_G3 en_USENGLISH_G3 en_US.UTF-8GB18030 CGB18030 en_US------------------------------Please enter language from above list [FRENCH]:FRENCHInput complete, UniData processing...Using UDTBIN=/disk1/ud82/binAll output and error logs have been savedto /disk1/ud82/bin/saved_logs directory.SMM is started.SBCS is started.CLEANUPD is started.SM is started.UniData R8.2.1 has been started.You now have completed the configuration process.This is the end of the configuration process.

6. Convert additional data.You may need to convert data in other accounts if you have been using a previous version ofUniData in English, or if your data files contain the delimiters reserved by UniData.Use the convmark command to convert all UniData files to conform to the language group. Thistool checks and converts your data for the system delimiters reserved by UniData.Syntax: convmark [-t] language_group_ID [path1 [path2 . . . ]]When you enter convmark without an argument, UniData returns a usage statement, giving thesyntax and possible arguments. The following table shows the arguments.

Chapter 2: Language configuration

14

Parameters Description

-t Returns the number of marks need to be converted, but does notconvert them.

langauge_group_ID Language group numbers correspond to the record mark, escapesequence, and the null value:▪ 159/130/129 French, Japanese, and English

▪ 255/192/129 English

▪ 30/31/30 Simplified Chinese and Englishpath 1[path2 ...] Specifies the full path to the files to convert.

You must be in udthome to convert the UniData files. Enter convmark and the Language GroupID for the language group you want to use. The convmark command converts all necessary filesin a directory, or you can specify particular files in a directory, as shown in the next examples. Ifyour data contains delimiters needing conversion, convmark converts them to marks for yourlanguage group. The -t option notifies you of files needing conversion, but does not convert them.

For more information about language groups, see Language groups, on page 6.

15

Chapter 3: Customizing UniData InternationalThis chapter describes how to use various tools, including ECL commands, and UniBasic commands tocustomize UniData International for use in your region.

Editing the DEFAULTS recordYou can use any editing tool to change the defaults for the localized message files. Any changeyou make in the language message file is saved for future UniData sessions. You can change anyattribute to display and print differently. For example, you may want the days of the week to appear asabbreviations, so Monday becomes Mon., Tuesday becomes Tues., and so forth.

Warning: Keep in mind that when you change the names of any of these attributes, the attributesstill refer to the original information. Be careful what you change in this file, because you see thisinformation every time UniData displays or prints headers that include dates, currency, and so on.

The language message files are located in the udthome/sys directory on UniData for UNIX andudthome\sys on UniData for Windows Platforms. From the UniData prompt, enter an editor and thename of the DEFAULTS record you want to edit. This example shows the FRENCH.MSG file.

:ED FRENCH.MSG DEFAULTS.},}FPOST}1DIMANCHE}LUNDI}MARDI}MERCREDI}JEUDI}VENDREDI}SAMEDIJAN}FEV}MAR}AVR}MAI}JUN}JLT}AOU}SEP}OCT}NOV}DECPRINTEMPS}ETE}AUTOMNE}HIVERY}N}QEND...“/tmp/__ED17400” 7 lines, 147 characters

The following is an example of the DEFAULTS record in the English language message file.

,}.}$}0Sunday}Monday}Tuesday}Wednesday}Thursday}Friday}SaturdayJanuary}February}March}April}May}June}July}August}September}October}November}DecemberWinter}Spring}Summer}AutumnY}N}QEND...“/tmp/__ED17400” 7 lines, 190 characters

Each value within a multivalued attribute is separated by a brace. The following table describes eachattribute in the MSG DEFAULTS record.

Attribute Description

1 Contains the thousand mark delimiter, the decimal delimiter, the currency sign, andthe date format.

European format (DD/MM/YY) = 1.

United States format (MM/DD/YY) = 0.

Chapter 3: Customizing UniData International

16

Attribute Description

2 Contains the name of an alternative message file (optional).3 Contains the names of the days of the week starting with Sunday. You can change

these names to abbreviations.4 Names of the months in the year starting with January. You can change these names

to abbreviations.5 Names of the quarters or seasons in the year (Spring, Summer, Autumn, Winter).6 Contains letters displayed for YES, NO, and QUIT. You can change these characters to

characters that you recognize for these words. A French user may want to change theletter Y to O for “oui”, keep N for “non” and change Q to F for “fin”.

The UniData ECL commands that set run time values for the defaults take priority over the DEFAULTSfile in a UniData session. These commands are as follows:

▪ DATE.FORMAT

▪ SET.MONEY

▪ SET.DEC

▪ SET.THOUS

For example, if you use SET.MONEY to change the monetary sign to the dollar sign ($) for your currentFrench UniData session, the default is still set to the Franc sign in the FRENCH.MSG DEFAULTS file.When you start another session, the Franc sign will appear as the monetary sign.

For more information on the ECL commands, see Commands reference, on page 23.

Adding a language to a language groupYou can add a language to a language group as long as all languages in the group use the samedelimiters for UniData delimiters. The UniData system file udthome/sys/LANGGRP on UniData forUNIX and udthome\sys\LANGGRP on UniData for Windows Platforms identifies language groups.Adding a new language to an existing language group requires editing the UniData LANGGRP file. Thefollowing items are optional:

▪ UNIX locale support

▪ Translated message files

Note: If you are adding a multibyte character set, refer to Multibyte language reference, on page32 for step-by-step instructions.

1. Check for users.Users must be logged off UniData, so you can stop all UniData processes. Enter the listusercommand. If there are users listed on the system have them log off now. If there are no currentusers, you can proceed.# listuserLicensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total( 32 + 32 ) / 64 0 0 0 0 0UDTNO USRNBR UID USRNAME USRTYPE TTY IP-ADDRESS TIME DATE

2. Stop UniData.Execute stopud from the udtbin directory:# stopud

3. Edit the LANGGRP file.

Adding a language to a language group

17

Use any text editor to add the language and locale to the LANGGRP file located in udthome/sys on UniData for UNIX or udthome\sys on UniData for Windows Platforms. The followingexample adds the Spanish udtlang, locale and description to Language Group 2:# vi LANGGRP# UniData language group file

BEGIN

255/192/129 # Language group 1 ENGLISH C # US English ENGLISH_UK english # UK EnglishEND

BEGIN

159/130/129# Language group 2 ENGLISH_G2 C # Group 2 English JAPANESE japanese.euc # EUC Japanese FRENCH french # French SPANISH es_ES # SpanishEND

4. Set up message file.UniData cannot operate in the new language unless a message file exists. From the system-levelprompt, copy the English message file or other message file in the language group. You musttranslate the contents of this to the new language. The message file name for each languageis the UniData language name concatenated to .MSG. See the LIST.LANGGRP, on page 24command for more information about udtlang names. The following example shows how theEnglish_G2.MSG file is copied and named SPANISH.MSG:% cp ENGLISH_G2.MSG SPANISH.MSG

5. Set the UDT_LANG environment variable.If your operating system does not have a locale setting for the new language, set the environmentvariable UDT_LANG to the new language. The following example, taken from UniData for UNIX,sets UDT_LANG to SPANISH, then displays the environment variables by executing the UNIX envcommand:% setenv UDT_LANG SPANISH% envTERM=xtermSHELL=/bin/csh...LANG=CUDTHOME=/usr/ud82UDTBIN=/usr/ud82/binUDT_LANG=SPANISH

To set the UDT_LANG environment variable on UniData for Windows Platforms, from the Startmenu, click Control Panel, then double-click System.Click Advanced system settings, press tab, then click Environment Variables. The EnvironmentVariables dialog box appears. Under System variables, click New. In the Variable name box,enter UDT_LANG. In the Variable value box, enter the language group.

6. Start UniData.From the udtbin directory, start UniData:# startudUsing UDTBIN=/disk1/ud82/binAll output and error logs have been savedto /disk1/ud82/bin/saved_logs directory.

Chapter 3: Customizing UniData International

18

SMM is started.SBCS is started.CLEANUPD is started.SM is started.UniData R8.2.1 has been started.

7. Start a UniData session.Change to the demo directory and start a UniData session: Your session starts in the newlanguage. Future sessions will also start in the designated language, until you change UDT_LANGor use SET.LANG to change it for a particular UniData session.

Starting UniData SQL in a local languageEnter SQL to start UniData SQL regardless of your language group setting:

:SET.LANG FRENCHLangage 'FRENCH' assigné !:SQLsql>

UniData SQL statements must be entered in English, but error messages are drawn from the messagefile of the language and are therefore displayed in the local language. The next example shows anerror message given in French:

a.:SQLa.sql> SELECT * FROM COURSES;a.Pas de privilège sur le fichier COURSES!

This message in English is: No privilege on file COURSES.

UDT.OPTIONS 53 U_PMOD_THROWAWAYUse UDT.OPTIONS 53 when a UniQuery statement in a local language contains throwaway keywords.

Note: This option affects ECLTYPE P only.

In the following example, the French OU is a throwaway keyword and a synonym for the English OR.The AVEC keyword is a synonym for the English keyword WITH. N and M are any VOC entry categories:

Language Text

English LIST VOC WITH F1 = “N” OR WITH F1 = “M”French LISTEZ VOC AVEC F1 = “N” OU AVEC F1 = “M”

The VOC file entry for the French OU looks like this:

@ID:OUf1:Uf2:OR

ON

19

ON

When this option is on, UniData searches for the keyword in the VOC file before checking a built-inUniData vocabulary table. If UniData finds the word in the VOC file, the VOC entry identifies it as asynonym for the English keyword. Therefore, UniData recognizes the French OU as a synonym for theEnglish throwaway keyword OR.

OFF

When this option is OFF, UniData does not check the VOC file first. Instead, it checks only the built-inUniData vocabulary table. Therefore, UniData does not recognize OU as a synonym for a throwawayEnglish keyword.

Using menus to translate VOC keywordsYou can further localize UniData by translating ECL keywords through the MENUS utility by changingthe names of commands in the VOC file. For more information about the VOC file, see Using UniData.

You can display a list of VOC records with the LIST VOC command.

1. To change a name for a VOC item, enter MENUS from an ECL prompt::MENUSThe following MENU Maintenance screen appears and prompts you to choose a selection:MENU Maintenance 18:17:43 Feb 09 19981= Enter/Modify a MENU2= Enter/Modify a formatted MENU3= Display a summary of all MENUs on a MENU file4= Display the contents of a MENU5= Enter/Modify a VOC MENU selector6= Enter/Modify a VOC stored sentence item7= Display all MENU selector item on the VOC file8= Display all stored sentence items on the VOC file9= Display the dictionary of a file10= Print a summary of all MENUs on a MENU file11= Print the contents of a MENU12= Print the dictionary of a file13= Enter/Modify a VOC stored paragraph item

2. Enter the number of the item you want, in this case number six.which would you like? (1 - 13) = 6

When you select number six, the system prompts you for a sentence name. Enter the name of theVOC record to change. A list of four elements appears, as shown in the following example:Sentence Name = UPDATE1 sentence name=UPDATE2 type=S3 description=QLV4 sentence=UPDATE

3. Choose attribute 1, sentence name, and change the name to the appropriate translated name.Repeat this step for all VOC item names that you wish to translate.Change=1name=METTRE_A_JOUR

4. When you display a list of all the stored sentence names (number 8 in the MENUS list), UniDatadisplays the new names.

Chapter 3: Customizing UniData International

20

For more information on MENUS, see Using UniData.

Sorting orderThe UniData COLLATIONS file defines the default sorting order for UniQuery reports. This file residesin udthome/sys on UniData for UNIX or udthome\sys on UniData for Windows Platforms. Youcan add records in COLLATIONS and change that record’s attribute order to reflect the sort order youwant. Then add an attribute to the language message file DEFAULTS record, pointing to that record tothe COLLATIONS file. This section describes how to add a record in the COLLATIONS file, how to pointto that record in the message file, and how a report displays with these changes.

Note: The sort order indicated in the COLLATIONS file affects only singlebyte languages. It is notrelevant to multibyte languages.

A record in the COLLATIONS file can contain up to 258 attributes, which contain the hexadecimalrepresentation of characters in ASCII order. The first two attributes in the file are reserved forcomments. You can create or modify the remaining 256 attributes. The ASCII and HEX character codesare listed in the UniBasic Commands Reference. Use this as a reference when modifying a COLLATIONSrecord.

The following is a graphical representation of the files, records, and attributes that togetherdetermine the sort order. The COLLATIONS file shows a customized record called CUSTOM.SORT.The ENGLISH.MSG file shows CUSTOM.SORT as attribute 7, pointing to the customized record inCOLLATONS.

Note: The default COLLATIONS file contains record 0, which is reserved for internal UniData use.You should not modify this record.

Adding a record to the COLLATIONS file

You must log on as root on UniData for UNIX or Administrator on UniData for Windows Platforms toedit the COLLATIONS file.

An easy way to modify the UniData sorting order is to copy an existing COLLATIONS record and modifyit. The following example shows the contents of the COLLATIONS file. Record 0 contains the defaultcollation order. TESTING is a copy of record 0 with the sort order changed.

LIST COLLATIONS 12:10:01 Apr 07 2010 1COLLATIONS

Adding a record to the COLLATIONS file

21

TESTING02 records listed

The next example shows how to copy the record TESTING to a new record, CUSTOM.SORT:

:COPY FROM COLLATIONS TO COLLATIONS TESTING, CUSTOM.SORT1 records copied

The attributes in the records in COLLATIONS are in hexadecimal format. Each alphanumericcombination stands for a character. The following table shows the default sorting order that UniDatauses. Notice that the order is alphabetical, from A through F.

Character HEX

A 41B 42C 43D 44E 45F 46

The next table shows the order of the TESTING record in the COLLATIONS file. The order has beenchanged to F through A. The character and HEX definitions are the same, just in a different attributeorder in the COLLATIONS TESTING record.

Character HEX

F 46E 45D 44C 43B 42A 41

The next example shows the same part of the new CUSTOM.SORT record as in the preceding tables.

Current UniData home is /disk1/ud82/.Current working directory is /disk1/ud82/sys.:AE COLLATIONS CUSTOM.SORTTop of "CUSTOM.SORT" in "COLLATIONS", 258 lines, 801 characters.*--: 66066: 3F067: 40068: 46069: 45070: 44071: 43072: 42073: 41074: 47075: 48076: 49

Chapter 3: Customizing UniData International

22

Pointing to a new record in the language message file

To point to a record in the COLLATIONS file, add the record name to attribute 7 of the DEFAULTSrecord of the appropriate language message file. In the previous section, CUSTOM.SORT was addedto COLLATIONS as a new sort record. The attributes in CUSTOM.SORT define the new sort order.The following example shows adding the COLLATIONS record CUSTOM.SORT to attribute 7 inENGLISH.MSG DEFAULTS record:

:AE ENGLISH.MSGRecord ids > DEFAULTSTop of "DEFAULTS" in "ENGLISH.MSG", 6 lines, 185 characters.001: , . $ 0002:003: Sunday Monday Tuesday Wednesday Thursday Friday Saturday004: January February March April May June July August September OctoberNovember December005: Winter Spring Summer Autumn006: Y N QBottom.*--: I007= CUSTOM.SORT*--: FIFiled "DEFAULTS" in file "ENGLISH.MSG".

In the next example, the sorting order is defined by the CUSTOM.SORT record. Notice that the firstname that begins with a letter is Flash Gordon. This is because, in CUSTOM.SORT, the letter F is thefirst alpha character in the CUSTOM.SORT record. The names display in reverse order up to the letterG. Then the sorting order is alphabetic.

LIST TAPES BY NAME NAME 11:59:02 Apr 08 2012 1TAPES..... Tape Name...........V8481 'Round MidnightV6670 2001V1254 Flash GordonV8181 Catch 22V996 Citizen KaneV2001 Blue VelvetV7456 A Clockwork OrangeV4951 American GraffitiV110 Girl FridayV1249 Gone With The WindV9431 HelpV4637 If...V5004 Journey AbroadB2297 Love StoryV4499 PsychoV1231 ScaramoucheV1077 SleuthB914 TammyV9961 The StalkerV5151 To Kill AEnter <New line> to continue...

23

Chapter 4: Commands referenceThis chapter covers UniData commands you use to change default settings such as date, time,currency, and decimal mark. UniData’s Environment Control Language (ECL) commands allow you tocustomize a UniData session.

Note: All of these commands, except convmark, make run time changes that affect only thecurrent session. When you start a new session, the settings return to the default settings. You canstore these commands in a LOGIN paragraph in the VOC file. The paragraph executes automaticallywhen a user enters the account. To change the defaults, see UPDATE.LANG.DEFAULTS, on page29.

DATE.FORMATThe ECL DATE.FORMAT command with option 1 displays all dates in European format (DD/MM/YY). You may also use DATE.FORMAT EUROPEAN to achieve the same format. To reset thedisplay to American format (MM/DD/YY), enter DATE.FORMAT 0 or DATE.FORMAT AMERICAN.DATE.FORMAT can be changed at any time during a UniData session, and affects the output formatsof a number of UniBasic and UniQuery commands including the FOOTING, HEADING, DATE, andTIMEDATE commands.

Note: DATE.FORMAT overrides the default set by the SET.LANG command.

Syntax

DATE.FORMAT {0 | 1 | AMERICAN | EUROPEAN}

Example

The following example shows how to change to the American DATE.FORMAT, then run a LISTcommand verifying the change. Notice that the query results are in the MM/DD/YY format:

:DATE.FORMAT 0:LIST CUSTOMER DATE_OUT BY.EXP DATE_OUT...2 01/01/942 01/03/9411 03/29/945 03/29/944 04/15/9410 04/19/949 04/20/949 04/20/949 04/21/941 04/23/943 04/23/947 04/23/948 04/23/94100 04/24/9412 04/24/941 04/24/941 04/24/946 04/24/94

Chapter 4: Commands reference

24

100 04/25/9415 04/25/948 04/25/9438 records listed

The next example shows how to change to the European DATE.FORMAT, then run a LIST commandverifying the change. Both the header and the query result formats are changed to the DD/MM/YYformat:

:DATE.FORMAT 1:LIST CUSTOMER DATE_OUT BY.EXP DATE_OUT

LIST CUSTOMER DATE_OUT BY.EXP DATE_OUT 12:33:25 04 Mar 2005 1Cust...... Date Out...2 01/01/942 03/01/9411 29/03/945 29/03/944 15/04/9410 19/04/949 20/04/949 20/04/949 21/04/941 23/04/943 23/04/947 23/04/948 23/04/94100 24/04/9412 24/04/941 24/04/941 24/04/946 24/04/94100 25/04/9415 25/04/948 25/04/9438 records listed

LIST.LANGGRPThis command displays the current language group ID.

Syntax

LIST.LANGGRP

Example

The following example shows the setting for language group 2:

:LIST.LANGGRPCurrent language group ID: 159/130/129

The next example shows the setting for language group 1:

:LIST.LANGGRP

SET.LANG

25

Current language group ID: 255/192/129

The following table shows the UniData language names (udtlang) and the language group identifiers.Language group numbers correspond to the record mark value (@RM), print at value (@PRINT_AT),and the NULL value.

Group # udtland name Language group ID

Group 1 English (US, UK) 255/192/129Group 2 Japanese (EUC)

French (ISO8859-1)

English_G2 (English)

159/130/129

Group 3 Simplified Chinese

English_G3

20/31/30

SET.LANGThe ECL SET.LANG command changes the language in the current UniData language group. Youcan specify the language by spelling it out in uppercase letters, or by entering the UniData languageID. Type AVAILABLE after SET.LANG to display a list of languages from which to choose, or typeCURRENT to display the current language setting. If you enter SET.LANG without parameters,UniData displays a usage statement.

Syntax

SET.LANG udt.lang | [CURRENT | AVAILABLE]

Parameters

The following table describes the SET.LANG parameters.

Option Description

udtlang Specifies the UniData operating language:

ENGLISH_G2

FRENCH

JAPANESECURRENT Displays the current language setting.AVAILABLE Displays the available language names.

Example

In the following example, the SET.LANG command without an argument displays a usage statement.The SET.LANG AVAILABLE command displays a list of current languages. Entering SET.LANGFRENCH selects French as the current UniData session language:

:SET.LANGUsage: SET.LANG <udtlang>|CURRENT|AVAILABLE:SET.LANG AVAILABLEENGLISH_G2JAPANESEFRENCH:SET.LANG FRENCH

Chapter 4: Commands reference

26

Langage 'FRENCH' assigné !

UniData changes the code set, message file, date format, numeric format, and money sign when youexecute SET.LANG. This command closes the current language message file, opens the new file, andreads the appropriate DEFAULTS record.

The defaults for the DEFAULTS record for each language are shown in the following table.

Variable ENGLISH_G2 FRENCH JAPANESE

Date MM/DD/YY DD/MM/YY YYYY/MM/DDNumeric 999,999.00 999.99,00 999,999Currency $9,999.00 F9.999,00 ¥9,999

Note: If UniData is started in English and you change the language to French using SET.LANG,UniData will run in French until the end of that UniData session. When you start another udtsession, UniData starts in the language defined by the LANG environment variable set at theoperating system level.

SET.MONEYThe ECL SET.MONEY command changes the delimiter that represents the currency sign. Use thiscommand when you need to change the money sign from the default set for your language. WhenSET.MONEY is used without an argument, the command returns a usage statement. The money signfollows the number in some regions, and UniData honors this convention when the POST option isused. If POST is not set, the money sign appears in the preceding (PRE) position.

Syntax

SET.MONEY sign [POST | PRE]

Example

The following example shows the result of the SET.MONEY command used without an argument:

:SET.MONEYUsage: SET.MONEY <money sign>

In this example the currency sign is set to the default for ENGLISH_G2, the dollar sign:

:SET.MONEY $:LIST TAPES COST NAME BY COSTLIST TAPES COST NAME BY COST 17:27:46 Mar 06 2010 1TAPES..... Tape Cost Tape Name...........B914 $9.99 TammyV110 $22.50 Girl FridayV1231 $23.00 ScaramoucheV5004 $23.25 Journey AbroadV1254 $23.50 Flash Gordon...V4637 $40.00 If...V2001 $44.00 Blue VelvetV4951 $45.00 American GraffitiV6670 $45.00 2001V8181 $45.00 Catch 22

SET.DEC

27

V996 $45.00 Citizen KaneV8481 $65.00 ‘Round MidnightV7456 $77.00 A Clockwork OrangeV1249 $78.00 Gone With The Wind21 records listed

In the next example, SET.MONEY changes the currency sign to the French franc and is positionedfollowing the number. The query returns the same results as the previous example, but the currencysign is now the franc sign (F):

:SET.MONEY FPOST:LIST TAPES COST NAME BY COSTLIST TAPES COST NAME BY COST 10:01:02 17 AVR 2010 1TAPES..... Tape Cost Tape Name...........B914 9,99 F TammyV110 22,50 F Girl FridayV1231 23,00 F ScaramoucheV5004 23,25 F Journey AbroadV1254 23,50 F Flash Gordon...V4637 40,00 F If...V2001 44,00 F Blue VelvetV4951 45,00 F American GraffitiV6670 45,00 F 2001V8181 45,00 F Catch 22V996 45,00 F Citizen KaneV8481 65,00 F ‘Round MidnightV7456 77,00 F A Clockwork OrangeV1249 78,00 F Gone With The Wind21 articles listés

Note: To display a space between the amount and the currency sign, use an extra space in thecommand line after the SET.MONEYcommand.

SET.DECThe ECL SET.DEC command changes the decimal point character for use with particular currency.The default character is the period (.).

Syntax

SET.DEC character

This command has the following restrictions:

▪ The decimal point and thousands delimiter cannot be the same character. For instance, whenSET.DEC is set as a comma (,), the period (.) is no longer a decimal point except in the constants inUniBasic programs and dictionary items.

▪ Decimal and thousand delimiters cannot be changed in the middle of the execution of a UniBasicprogram.

Example

In the following example, the SET.DEC command changes the decimal character to a comma (,):

Chapter 4: Commands reference

28

:SET.DEC ,

The next example shows the results of a LIST statement after the decimal is set as a comma:

LIST TAPES COST NAME BY COST 17:51:45 Mar 06 2010 1TAPES..... Tape Cost Tape Name...........B914 $9,99 TammyV110 $22,50 Girl FridayV1231 $23,00 ScaramoucheV5004 $23,25 Journey AbroadV1254 $23,50 Flash GordonV4341 $23,50 ZV4499 $23,50 Psycho...

SET.THOUSThe ECL SET.THOUS command changes the character that indicates a break for thousands. A comma(,) is the default character.

Syntax

SET.THOUS character

This command has the following restrictions:

▪ The decimal point and thousands delimiter cannot be the same character. For instance, whenSET.DEC is set as a comma (,), the period symbol (.) loses its functionality as a decimal pointexcept in the constants in UniBasic programs and dictionary items.

▪ Decimal and thousand delimiters cannot be changed in the middle of the execution of a UniBasicprogram.

Example

In the following example, the SET.THOUS command sets the thousands break character to a period(.):

:SET.THOUS .LIST STAFF SAL BY NAME 13:46:17 Mar 29 2010 1STAFF..... Salary.1 31.2008 98.0007 29.9002 25.8003 42.0004 32.5006 35.8009 19.9005 26.8009 records listed

In the following example, the SET.THOUS command sets the thousands break character to acomma(,):

:SET.THOUS ,LIST STAFF SAL BY NAME 13:47:58 Mar 29 2010 1STAFF..... Salary.1 31,200

UPDATE.LANG.DEFAULTS

29

8 98,0007 29,9002 25,8003 42,0004 32,5006 35,8009 19,9005 26,8009 records listed

UPDATE.LANG.DEFAULTSThis command updates the language DEFAULTS record in the language message files. UniData savesthe changes you make for future UniData sessions.

Syntax

UPDATE.LANG.DEFAULTS

Follow this procedure to execute this command.

1. To access the DEFAULTS record, enter UPDATE.LANG.DEFAULTS from the UniData prompt:

:UPDATE.LANG.DEFAULTS2. The screen prompts you for the name of the language message file that you need to update. The

following example requests the ENGLISH_G2.MSG file. UniData displays a data record, listing theattributes and their current values.

:UPDATE.LANG.DEFAULTS<udtlang>.MSG=?ENGLISH_G2.MSGMSG.DEFAULTS RECORD ID==>DEFAULTS0 @ID=DEFAULTS1 ALTERNATIVE_MESSAGE_FILE=2 COLLATION=3 ==>THOU_DEC_MON_DATEFORMAT4 ==>DAYS_OF_WEEK5 ==>MONTHS6 ==>SEASONS7 ==>PROMPTSFROM 3 to 7 ARE MULTI VALUED FIELDS SCREENS.Enter 'DELETE' 'UNCHANGE' 'QUIT' or NUMBER to changeChange=

Attribute Description

@ID= Name of the message file. We do not recommend changingthe name of this file.

ALTERNATIVE_MESSAGE_FILE Alternative message file. There is no default alternativemessage file.

UDTLANGS Available languages in the current language group.CURRLANG_THOU_DEC_MON_DATEFORMAT

Current language number, thousand delimiter, decimaldelimiter, money sign and date format.

DAYS_OF_WEEK Days of the week.MONTHS Months of the year.SEASONS Seasons of the year.PROMPTS Prompts for yes (Y), no (N), and question (Q).

Chapter 4: Commands reference

30

Once you enter an attribute number, you have the option to insert, delete, or change its value. Ifyou enter an attribute and decide not to make a change, enter UNCHANGE. UniData returns to themain menu. To exit the menu, enter QUIT.

3. Choose the number of the attribute you wish to change, or choose one of the options at thebottom of the screen. The next example shows how to change the PROMPTS default from “Y” for“yes” to “O” for “oui.”UniData prompts for the line number, which is 1 in the example, then prompts for the column,which is also 1. The Y_N_Q line is displayed. You can change all of the prompts by following thisformat, but, for this example, only the Y is changed to O. When you press Enter, UniData displaysall of the values, and you can see the change you just made.

Change=7MSG.DEFAULTS RECORD ID==>MULTI VALUED FIELDS SCREENColumn No. 1No. PROMPTS1 Y2 N3 Q4Change which line=1Enter 'DELETE'/ 'INSERT' /Column number to change=1Y_N_Q=OChange which column=MSG.DEFAULTS RECORD ID==>Column No. 1No. PROMPTS1 O2 N3 Q4

Tip: You can also change the language DEFAULTS record using any system editor. See Editingthe DEFAULTS record, on page 15.

convmarkThis tool checks for and converts the ASCII characters reserved for use as UniData delimiters. Youneed to run convmark when you change language groups from Group 1 to Group 2. To run UniData inLanguage Group 2, run this command after you install or update UniData. This assures that your datais compatible with the current language configuration.

The convmark command recursively converts all files in a directory, or converts given filesindividually.

For specific instructions on using convmark see Language configuration, on page 11.

Syntax

convmark [ -t] language_group_ID [path1 [path2 ...]]

Parameters

The following table describes the parameters for convmark.

convmark

31

Parameter Description

-t Returns how many marks need to be converted, but does notconvert them.

(language_group_ID) Language group IDs correspond to the record marks, escapesequence, and the null value:

159/130129 French, Japanese and English

255/192/129 English

20/31/30 Simplified Chinese and English[(path 1) (path 2). . .]] Specifies the full path to the directory or files to convert.

32

Chapter 5: Multibyte language referenceMultibyte language handling poses unique problems in terms of computer display and storage.The first part of this chapter explains how UniData International stores and displays multibytecharacters and strings. Included is a multibyte configuration table to help you understand howUniData International handles multibyte processing.

The second part of this chapter provides UniBasic functions to aid developers working in languagesusing multibyte character sets.

Note: The examples used in this chapter are graphical representations of multibyte characterstrings.

Limitations and exclusionsUniData does not support all character sets or multibyte encoding at this time. The followinglimitations and exclusions exist in this version of UniData International:

▪ LIST.LABEL — lines do not wrap properly if the label contains more than one column when usingthe Japanese Half Katakana character set.

▪ SORT.LABEL — lines do not wrap properly if the label contains more than one column when usingthe Japanese Half Katakana character set.

▪ Byte Limitation — maximum number of 4 bytes per character.

▪ Code Range Limitation — maximum code range of four for each byte.

▪ Code Set Limitation — maximum of four code sets for each encoding method.

▪ ASCII Code — is a subset of the multibyte encoding system.

▪ Multibyte Code Value Range — cannot include ASCII code range.

Storing charactersCharacters are stored in UniData according to the encoding method of your application.

The following example represents a string of 4 characters. The numbers below each characterindicates the number of bytes the character contains. The storage size for this string is 8 bytes.

Displaying charactersFor all languages using a Latin character writing system, such as French or English, the display widthof a character always matches its internal storage length (in terms of bytes).

CJK ideographical writing systems require multibyte code sets for language processing. Accordingto the EUC Kanji system for the Japanese language, single-byte characters and two-byte characters

Multibyte configuration file

33

are mixed. While a single byte character has a display width of 1 character, a two-byte character has adisplay width of either one or two characters.

This combination of character widths determines how UniData wraps text lines. This applies towrapping at the end of the physical display line and wrapping under each column heading in UniQueryoutput. The backspace key is a component of this issue. UniData erases the entire character behindthe cursor when you use the backspace key, regardless of the characters display width.

Multibyte configuration fileUniData International processes and displays multibyte character sets through the multibyteconfiguration table, called MULTIBYTE.CONFIG. Each multibyte language, or encoding system, has anentry in this file. UniData uses this file to process, input, and display multibyte data.

UniData searches this file when you change or start a UniData session in a different language. If thereis no entry in this file, UniData assumes a single-byte encoding method.

Adding a multibyte language to UniDataYou must be logged on as root on UniData for UNIX or Administrator on UniData for WindowsPlatforms to perform this process.

Warning: You should understand the code page of any multibyte language you want to add toUniData. You need to know the number of bytes each character takes to display and to store. Askyour operating system vendor for details on your character set.

If any of the multibyte characters used in the language and code page you want to add contain asystem mark character, orphaned bytes are created and may cause data loss.

1. Check for users.Users must be logged off UniData, so you can stop all UniData processes. Enter the listusercommand. If there are users listed on the system have them log off now. If there are no currentusers, you can proceed.# listuserLicensed(UDT+CP)/Effective Udt Sql iPhtm Pooled Total( 32 + 32 ) / 64 0 0 0 0 0UDTNO USRNBR UID USRNAME USRTYPE TTY IP-ADDRESS TIME DATE

2. Stop UniData.Execute stopud from the udtbin directory:# stopud

3. Add an entry to the MULTIBYTE.CONFIG file.Use vi or another editor to add an entry to the MULTIBYTE.CONFIG file located in the udthome/sys directory on UniData for UNIX or udthome\sys directory on UniData for WindowsPlatforms. The syntax and examples follow. See your host system documentation for theencoding detail.Syntax:# Begin entry for Languageudtlang # udtlang namebytes:display width:1st range,2nd range # encoding 1bytes:display width:1st range,2nd range # encoding 2END # End entry for Language

Parameters:Each entry must follow the preceding syntax format. The following table describes each element.

Chapter 5: Multibyte language reference

34

Parameter Description

BEGIN Start of the entry.udtlang udtlang name is the language name you will use for this language.bytes Number of bytes required to store one character.display width Display width of one character.ranges Code range for each byte. Ranges for bytes are separated by a comma.END End of the entry.

Examples:The following is an example of the MULTIBYTE.CONFIG file entry for the Japanese EUC encodingsystem.BEGIN # Japanese EUCJAPANESE # udtlang name2:2:160-255:160-255 # EUC code set 1. 2 bytes, 2 display widths.2:1:142:160-255 # EUC code set 2. (half-katakana), 2 bytes, 1 display3:2:143:160-255:160-255 # EUC code set 3. 3 bytes, 2 display widthsEND # Japanese EUC

The following is an example of the MULTIBYTE.CONFIG file entry for the Chinese GB encodingsystem. Blank lines are added for legibility. BEGIN # GB 2312, Chinese simplifiedCHINESE.GB # udtlang name for GB 23122:2:161-254:161-254 # 2 bytes, 2 display widths. # first byte range: 161-254 # second byte ranges: 64-126, 161-254END # end of CHINESE.GBBEGIN # Fusheng encodingCHINESE.FS # udtlang name for Fusheng4:2:176-191:49-90:49-90:49-90 # 4 bytes, 2 display widths. # first byte range: 176-191 # second-4th byte ranges: 49-90END # end of CHINESE.FS

4. Add the language to LANGGRP.The following example adds the Chinese GB udtlang and description to Language Group 2:% vi LANGGRP# UniData language group fileBEGIN255/192/130# Language group 1ENGLISH C # US EnglishENGLISH_UK english # UK EnglishENDBEGIN159/130/129# Language group 2ENGLISH_G2 C # Group 2 EnglishJAPANESE japanese.euc # EUC JapaneseFRENCH french # FrenchCHINESE_GB # ChineseGB 2312BEGIN20/31/30END

If no locale exists for the encoding method of the added language, leave the locale name columnblank in the LANGGRP file. UniData uses the current locale in this case, and uses the informationin the MULTIBYTE.CONFIG file to process multibyte characters. For example, if the locale is “C,”UniData looks for CHINESE_GB in the MULTIBYTE.CONFIG table. UniData finds the entry, which

Adding a multibyte language to UniData

35

instructs UniData in processing multibyte characters for CHINESE_GB. UniData can store andretrieve data only with this method.

5. Set up the message file.UniData searches udthome/sys on UniData for UNIX or udthome\sys on UniData forWindows Platforms for a language message file when you start UniData. There must be a messagefile with a file name in this format: UDTLANG.MSG.If no translated message file exits, you must copy another message file from a language in thesame language group. For example, there is no translated message file for CHINESE.GB, so youmust copy an existing message file. The following example shows how the English_G2.MSG fileis copied and named CHINESE_GB.MSG. Now any time an error message appears, it displaysin English. From the UNIX prompt, copy the English message file or other message file in thelanguage group:% cd sys% cp ENGLISH_G2.MSG CHINESE_GB.MSG

6. Set the UDT_LANG environment variable.Use this variable if your system does not have a locale setting for the new language. Set theenvironment variable UDT_LANG to the new language. The following example shows how to setUDT_LANG to CHINESE_GB on UniData for UNIX. Use the UNIX env command (or equivalent) toverify your change.% setenv UDT_LANG CHINESE_GB% envTERM=xtermSHELL=/bin/csh...LANG=CUDTHOME=/usr/ud82UDTBIN=/usr/ud82/binUDT_LANG=CHINESE_GB%

To set the UDT_LANG environment variable on UniData for Windows Platforms, from the Startmenu, click Control Panel, then double-click System.Click Advanced system settings, press tab, then click Environment Variables. The EnvironmentVariables dialog box appears. Under System variables, click New. In the Variable name box,enter UDT_LANG. In the Variable value box, enter the language group.

Note: Any changes to the environment that you make from the UNIX prompt are valid onlyfor the current UniData session. You can change your .login file if you want future UniDatasessions to use these same settings.

7. Start UniData.From the udtbin directory, start UniData:# startudUsing UDTBIN=/disk1/ud82/binAll output and error logs have been savedto /disk1/ud82/bin/saved_logs directory.SMM is started.SBCS is started.CLEANUPD is started.SM is started.UniData R8.2.1 has been started.

8. Start a UniData session.

Chapter 5: Multibyte language reference

36

Change to the demo directory and start a UniData session: Your session starts in the newlanguage. Future sessions will also start in the designated language, until you change UDT_LANGor use SET.LANG to change it for a particular UniData session.

9. Edit the DEFAULTS record.Change the DEFAULTS record in the language message file if you want to change the settings formoney sign, thousand delimiter, and so forth. You can also change the days of the week, month,and season to the correct name in your language. See Customizing UniData International, onpage 15 for instructions.

UniBasic multibyte supportThis section summarizes UniBasic’s support of languages that require multiple bytes to represent asingle character.

▪ Modified Functions and Commands — These functions support multibyte languages.

▪ Single-byte Functions — These functions support only singlebyte languages.

▪ Multibyte Functions — These functions are designed specifically for multibyte language support.

Multibyte languages require that strings be recognized by character rather than byte. These changesdo not affect functionality for single-byte languages, because, for these languages, one byterepresents each character.

Modified functions and commands

The following table lists the UniBasic functions that have been modified to analyze strings bycharacter instead of byte.

Function Comment

CHANGE Replaces all occurrences of a substring with a string.CHAR Changes a numeric expression to its ASCII (American Standard Code for

Information Interchange) character string equivalentCHARS Changes a numeric value in an array to its ASCII character equivalent.COL1 Returns the column position preceding a substring found by the FIELD

function.COL2 Returns the column position following a substring found by the FIELD

function.CONVERT Converts a single- or multibyte character string to another character string.COUNT Returns the number of times a substring appears within a string.COUNTS Returns the number of times a substring appears within each element of an

array.DCOUNT Counts delimited substrings.FIELD Locates and returns a substring or group of substrings; treats a string as an

array, with fields delimited by any ASCII character. See also COL1 and COL2in this table.

FINDSTR Determines the position of a substring in a dynamic array.GET Receives unprompted input from an attached line.ICONV Converts string or numeric data to internal representation format based on

conversion codes.

Singlebyte functions

37

Function Comment

INDEX Returns the starting position of a specified occurrence of a substring withina string.

INPUT Requests data from an input queue or the terminal screen.INPUT @ Places the cursor at a specific location on the terminal screen and requests

input from the user. See the note on mask parameters later in this chapter.LEN Returns the length of an expression.LENS Returns the length of the values within each element of a dynamic array.MATCH Determines if a variable matches a specific pattern of characters or

numbers. Only single-byte characters are considered to be alphabetic ornumeric.

MATCHFIELD Returns a substring that matches a pattern or literal. Only single-bytecharacters are considered to be alphabetic or numeric.

OCONV Converts string or numeric data from internal format to display formatbased on conversion codes.

REMOVE Searches a dynamic array for system delimiters, then assigns the delimiterand following array element to a variable. Recognizes col.pos as acharacter position.

SEQ Converts a single character to its ASCII code value.SEQS Converts the first character in each element of a dynamic array to its ASCII

code value.SUBSTRINGS Extracts strings from elements within a dynamic array.SWAP Replaces all occurrences of one substring with a second substring.

Note: Mask — multibyte characters may be masked for display purposes; however, eachdoublebyte character uses two display characters. So, four doublebyte characters displayed in themask“###-###” prints as “XX -XX ” (two characters, space, hyphen, two characters, and a space).

Singlebyte functions

The functions listed here may not work properly when used with a multibyte character set.

Function Comment

ALPHA Because UniBasic does not recognize multibyte characters as alphabetic,returns 0 instead of converting them.

DOWNCASE Converts only singlebyte characters to lower case.FMT Formats an expression for display. The length parameter defines the

number of display characters. The fill character must be single-byte, andthe justification option does not work for multibyte languages. See thenote on mask following this table.

NUM Determines if an expression is numeric. Returns 0 for multibyte characters.NUMS Determines, for each element of an array, if that element is numeric.

Returns 0 if the dynamic array element contains multibyte characters.PROMPT Sets the prompt displayed by the INPUT command to a specified single-

byte character. You cannot prompt with a multibyte character.SOUNDEX Converts an expression into a phonetic code. May return unpredictable

results with multibyte characters.

Chapter 5: Multibyte language reference

38

Function Comment

UPCASE Converts only single-byte characters to upper case.

Note: Mask — multibyte characters may be masked for display purposes; however, each double-byte character uses two display characters. So, four doublebyte characters displayed in themask“###-###” prints as “XX -XX ” (two characters, space, hyphen, two characters, and a space).

Multibyte functions

The following UniBasic functions are designed for use with multibyte character sets.

Function Description

BYTELEN Returns the number of bytes in a string.CHARLEN Returns the number of characters in a string.DISPLAYWIDTH Returns the number of bytes required to display a string expression.ISMB Returns a 0 for single-byte language setting, 1 for multibyte language

setting.LEN Returns the number of bytes in a string.MBLEN Returns the number of bytes required to display a character.

Note: The examples used here are graphical representations of multibyte character strings.

BYTELENThis UniBasic function returns the number of bytes required to store a character. From one to fourbytes may be required.

Syntax

BYTELEN (string)

Example

The following representation of a string indicates below each “character” the number of bytesrequired to store that character. The string contains 8 bytes, therefore, BYTELEN would return 8 forthis string.

CHARLENThis UniBasic CHARLEN function returns the number of characters in a character string. A multibytecharacter may require from one to four bytes to encode.

DISPLAYWIDTH

39

Syntax

CHARLEN (string)

Example

The following is a representation of a string of four multibyte characters. CHARLEN would return 4 forthis string.

DISPLAYWIDTHThis UniBasic function returns the number of bytes needed to display a string expression. For instance,the display width of English characters is one. In languages that use multibyte characters, the displaywidth of a character can be 1, 2, 3 or 4 bytes, depending on the language and the character.

Syntax

DISPLAYWIDTH (string)

Example

The following representation of a string indicates below each “character” the number of bytesrequired to display that character. The string contains 8 bytes, therefore, DISPLAYWIDTH wouldreturn 8 for this string.

ISMBThis UniBasic function returns a code indicating whether the currently installed language is made upof a single-byte or multibyte character set. The function returns 0 to indicate a single-byte characterset, or 1 for a multibyte character set. For example, this function executed in a UniData session forwhich the language is English returns 0; executed in a UniData session for which the language isJapanese, the function returns 1.

Syntax

ISMB()

Chapter 5: Multibyte language reference

40

LENThe UniBasic LEN function returns the length of character expression str.expr. LEN supports multibytelanguages. With null value handling on, the null value has a length of one byte.

Syntax

LEN(str.expr)

Example

In the following example, the program segment displays 14, the length of the string NAME:

NAME = "Arthur Fiedler" PRINT LEN(NAME)

The following representation of a string indicates below each “character” the number of bytesrequired to store that character. The string contains 8 bytes, therefore LEN would return 8 for thisstring.

MBLENThis UniBasic function returns the number of bytes in the first character of a string.

Syntax

MBLEN (string expression)

Example

The following representation of a string indicates below each “character” the number of bytesrequired to display that character. MBLEN returns 2 for this string, indicating that the first character ismade up of 2 bytes.

41

Appendix A: UniData and UNIX localeAn important element in UniData International is the system-level locale. UniData has a file calledLANGGRP in the udthome/sys on UniData for UNIX or udthome\sys on UniData for WindowsPlatforms, which defines the locale LANG setting. When you start the configuration for a language,UniData looks to the LANG setting. If the setting is incorrect for the language you want to use, theconfiguration will not work.

UniData can run without locale, but it is not fully operational. For example, uppercase and lowercasesearches and sorting will not function. To use UniData without locale, you must edit the LANGGRP fileso that locale name (in lower case in the example) for the language you will use is blank.

# UniData language group fileBEGIN255/192/129 # Language group 1ENGLISH C # US EnglishENGLISH en_US # US EnglishENGLISH en_US.UTF-8 # US EnglishEND

BEGIN159/130/129 # Language group 2ENGLISH_G2 C # Group 2 EnglishENGLISH_G2 en_US # Group 2 EnglishENGLISH_G2 en_US.UTF-8 # US EnglishJAPANESE ja # EUC JapaneseFRENCH fr # FrenchEND

BEGIN20/31/30 # Language group 3ENGLISH_G3 C # Group 3 EnglishENGLISH_G3 en_US # Group 3 EnglishENGLISH_G3 en_US.UTF-8 # US EnglishGB18030 C # Simplified Chinese GB18030GB18030 en_US # Simplified Chinese GB18030END

There are no industry standards for naming locale. To find out available names, use the localecommand with the -a argument to display a list of locale settings available on your machine. Thefollowing example was generated on an AIX machine:

% locale -aen_US.ISO8859-1En_US.IBM-850de_CH.ISO8859-1De_CH.IBM-850de_DE.ISO8859-1De_DE.IBM-850en_GB.ISO8859-1En_GB.IBM-850es_ES.ISO8859-1Es_ES.IBM-850fr_BE.ISO8859-1Fr_BE.IBM-850fr_CA.ISO8859-1Fr_CA.IBM-850fr_CH.ISO8859-1Fr_CH.IBM-850

Appendix A: UniData and UNIX locale

42

fr_FR.ISO8859-1Fr_FR.IBM-850ja_JP.IBM-eucJPen_JP.ISO8859-1Ja_JP.IBM-932En_JP.IBM-850zh_TW.ozh_TW.IBM-eucTW%

On most systems, the locale command without an argument displays a list similar to the following:

% localeLANG=CLC_CTYPE="C"LC_COLLATE="C"LC_MONETARY="C"LC_NUMERIC="C"LC_TIME="C"LC_MESSAGES="C"LC_ALL=

Tip: The “C” category stands for English and is the default value on most machines, according tothe International Standards Organization’s “C” specifications.

The next example shows the LANG set for French:

% localeLANG=fr_FRLC_CTYPE="C"LC_COLLATE="C"LC_MONETARY="C"LC_NUMERIC="C"LC_TIME="C"LC_MESSAGES="C"LC_ALL=

Note: You do not need to use the entire locale name. For instance, in the locale -a list, French islisted as fr_FR.iso88519. You can just set LANG to fr_FR.

Locale environment variablesThe following table describes each variable found in locale. The LANG setting overrides thesevariables, so you do not need to set them individually. If you want to override the individual settings,you must do this within UniData.

Variable Description

LANG Controls the character set and language.LC_TYPE Controls character handling functions.LC_COLLATE Specifies the sorting order.LC_MONETARY Specifies monetary formats.LC_NUMERIC Specifies the decimal delimiter and the thousand delimiter.LC_TIME Specifies date and time formats, including names of days, months, and

seasons.

Locale environment variables

43

Variable Description

LC_MESSAGES Contains translated messages.LC_ALL Overrides all the other LC directory settings.


Recommended