Home
Informix Guide to GLS Functionality, February 1998
Contents
1. os iso_8859_1 iso_8859_1 Examine the IcX txt files to determine the GLS locales that the INFORMIXDIR gls lcX directory on your system supports Informix Guide to GLS Functionality Filena Betwee and Filena Betwee and Filena Betwee and Listing Code Set Conversion Files Listing Code Set Conversion Files When you specify the cv command line option the glfiles utility creates a file that lists the available code set conversion files For each evY subdi rectory in INFORMIXDIR gls glfiles creates a file in your current directory that is called cvY txt where Y is the version number of the code set conversion object file format The cvY txt file lists the code set conversions in alphabetical order sorted on the name of the object code set conversion file For two way code set conversions the INFORMIXDIR gls cvY directory contains two code set conversion files One file supports conversion from the characters in code set A to their mappings in code set B and another supports the conversion in the return direction from code set B to code set A For more information on two way code set conversion see page A 14 Figure A 4 shows a sample file cv9 txt that contains the available code set conversions Figure A 4 es cv9 002501b5 cvo cv9 01b50025 cvo Sample glfiles File Code Set Greek i Code Set IBM CCSID po es cv9 00250333 cvo cv9 03330025 cvo Conversion Files Code Set Greek Code
2. Era Based DBTIME Formats p 2 23 ALS Informix products support the era based extension in DBTIME for backward compatibility with Informix ALS products Informix recommends that you use the GL_DATETIME environment variable see page 2 37 for date and time end user formats in client applications for Version 9 1 or later databases For a description of the standard DBTIME formats and general information about this environment variable refer to the Informix Guide to SQL Reference This section describes the era based Asian formats that DBTIME supports For more information on era based dates and times see Era Based Date and Time Formats on page 1 51 2 22 Informix Guide to GLS Functionality Era Based DBTIME Formats DBTIME Era Based DBTIME Formats The DBTIME environment variable supports special extensions to format values in DATETIME columns as era based dates and times The following diagram shows the syntax for the era based formatting directives that DBTIME supports gt String A _ gt string is the formatting directives that specify the end user format for the DATETIME values You can use any formatting directive that formats nonera based dates and times For a list of these formatting directives see the entry for DBTIME in the Informix Guide to SQL Reference You can also use the era based formatting directives that the following list describes EC Eg Ey accepts
3. A Client locale Database locale When you set the same or compatible GLS locales for each of these locales your client application is not dependent on how the operating system of each computer implements language specific features The following sections describe each of these locales in more detail The Client Locale The client locale specifies the language territory and code set that the client application uses to perform read and write I O operations on the client computer In a client application I O operations include reading a keyboard entry or a file for data to be sent to the database and writing data that the database server retrieves from the database to the screen a file or a printer In addition an SQL API client uses the client locale for literal strings end user formats embedded SQL statements host variables and data sent to or received from the database server with ESQL library functions in an ESQL source file ec GLS Fundamentals 1 23 Locales in the Client Server Environment 1 24 In the sample connection that Figure 1 2 on page 1 23 shows if the client locale is German with the Microsoft 1252 code set de_de 1252 the German locale specific information that the ESQL C client application uses includes the following m Valid date end user formats support the following format for the U S English date of Tuesday 02 11 1997
4. Informix Guide to GLS Functionality Using Code Set Conversion Using Code Set Conversion If you have a character buffer to hold character data from a database you must ensure that this buffer is large enough to accommodate any expansion that might occur if the application uses code set conversion For more infor mation on code set conversion see Performing Code Set Conversion on page 1 40 If the client and database locales are different and convertible the appli cation might need to expand this value For example if the fname column is defined as CHAR 8 the following ESQL C code fragment selects an 8 byte character value into the 10 byte buf1 host variable char buf1 10 EXEC SQL select fname into bufl from tabl where cust_num 29 You might expect that a 10 byte buffer would be adequate to hold an 8 byte character value from the database However if the client application expands this value to 12 bytes the value no longer fits in the buf1 buffer The fname value would be truncated to fit into buf1 possibly creating partial characters if fname contains multibyte characters For more information on partial characters see Partial Characters in Column Substrings on page 3 37 To avoid this situation make sure that you define buffers to handle the maximum character expansion possible 4 bytes in the conversion between your client and database code sets General SQL API Features 5 27 INFORMI
5. e h iy iY m n t SOW xX y Y P GL_ DATE is replaced by the day of the month as a decimal number 1 through 31 A single digit is preceded by a space is the same as the b formatting directive is replaced by the year as a 2 digit decade 00 through 99 for both scanning and printing It is the Informix specific formatting directive for y For more information see The Year Formatting Directives on page 2 30 is replaced by the year as a 4 digit decimal number 0000 through 9999 for both scanning and printing It is the Informix specific formatting directive for Y For more information see The Year Formatting Directives on page 2 30 is replaced by the month as a decimal number 01 through 12 is replaced by a newline character is replaced by the TAB character is replaced by the weekday as a decimal number 0 through 6 0 represents the locale equivalent of Sunday is replaced by a special date representation that the locale defines requires that the year be a 2 digit decimal number 00 through 99 for both scanning and printing For more infor mation see The Year Formatting Directives on page 2 30 requires that the year be a 4 digit decimal number 0000 through 9999 for both scanning and printing For more information see The Year Formatting Directives on page 2 30 is replaced by to allow in the format string GLS Environment Var
6. If you do not set CC8BITLEVEL esql converts non ASCII characters in literal strings and comments You can modify the value of CC8BITLEVEL to reflect the capabilities of your C compiler For more information on CC8BITLEVEL see page 2 5 INFORMIX ESQL C Features 6 11 Handling Code Set Conversion AD XP Handling Code Set Conversion When the client and database code sets differ the ESQL C client application performs code set conversion on character data For more information see Performing Code Set Conversion on page 1 40 If your ESQL C appli cation executes in an environment in which code set conversion might occur make sure that the application correctly handles the following situations When the application writes blobs BYTE and TEXT values to the database it must set the loc_type field in the locator structure loc_t to indicate the type of blob that it needs to write For general information on loc_type and loc_t see the INFORMIX ESQL C Programmer s Manual When the application writes CLOB and BLOB data to the database in Dynamic Server with UD Option it uses various large object LO file descriptors For detailed information see the INFORMIX ESQL C Programmer s Manual When the application uses the sqlda structure to describe dynamic SQL statements it must account for possible size differences in character data For general information on the sqlda structure see the INFORMIX ESQL C P
7. Non ASCII Utility Name Non ASCII Characters in Command Line Arguments Output onspaces p pathname None f filename onstat o filename dest Yes filename_source onunload database table Yes t source 2 of 2 Figure 4 4 shows utilities for Dynamic Server with AD and XP Options that accept non ASCII characters in command line arguments or produce non ASCII output Figure 4 4 Database Server Utilities That Support Non ASCII Characters Non ASCII Utility Name Non ASCII Characters in Command Line Arguments Output onstat Yes onutil CHECK TABLE DATA database owner table Yes CHECK TABLE INFO database owner table You can use the xctl utility to wrap utilities such as onstat Database Server Features 4 17 Support by SQL Utilities AD XP Figure 4 5 shows INFORMIX SE utilities that accept non ASCII characters in command line arguments Figure 4 5 SE Utilities That Support Non ASCII Characters Utility Name Non ASCII Characters in Command Line Arguments Non ASCII Output secheck filename None selog log filename None f tablename The SE utilities accept non ASCII characters in the parameters for filename log filename and tablename Support by SQL Utilities The DB Access utility generates labels and messages in the code set of the client locale DB Access accepts multibyte command line arguments for database and script_file The following SQL utilities also accept non ASCII characters in c
8. Performance Considerations for NCHAR and NVARCHAR The NCHAR data type is very similar to the CHAR data type and NVARCHAR is very similar to the VARCHAR data type The difference between these data types is as follows m The database server collates NCHAR and NVARCHAR column values in localized order m The database server collates CHAR and VARCHAR column values in code set order Localized collation is dependent on the sorting rules that the locale defines not simply on the computer representation of the character the code points This difference means that the database server might perform complex processing to compare and collate NCHAR and NVARCHAR data Therefore access to NCHAR data might be slower with respect to comparison and collation than to CHAR data Similarly access to data in an NVARCHAR column might be slower with respect to comparison and collation than access to the same data ina VARCHAR column Assess whether your character data needs to take advantage of localized order for collation and comparison If code set order is adequate use the CHAR and the VARCHAR data types SQL Features 3 17 Other Character Data Types 3 18 Other Character Data Types The choice of locale can affect the character data types CHAR VARCHAR and TEXT This section describes how this choice affects each of these character data types The CHAR Data Type The CHAR data type stores character data in a fixed length field This da
9. sss Therefore the WHERE clause contains the following condition WHERE 6 6 The problem of partial characters does not occur in single byte code sets because each character is stored in a single byte When your database locale supports a single byte code set and you specify a particular column substring in a query the database server returns exactly the subset of data that you requested and does not replace any characters with white spaces Partial Characters in an ORDER BY Clause Partial characters might also create a problem when you specify column substrings in an ORDER BY clause of a SELECT statement The general format for specifying column substrings in the ORDER BY clause is as follows ORDER BY column name first last In this format first represents the first byte of the first character in the column substring and last represents the last byte of the last character in the column substring If the locale supports a multibyte code set whose characters are all of the same length you can use column substrings in an ORDER BY clause However the more likely scenario is that your multibyte code set contains characters with varying lengths In this case you might not find it useful to specify column substrings in the ORDER BY clause For example suppose that you want to retrieve all rows from the multi_data table and you want to use the multi_chars column with a column subscript to collate the query results Th
10. 2 Informix Guide to GLS Functionality CTYPE category 1 24 current processing locale 7 4 customizing 1 49 definition of 1 23 1 26 determining 1 24 ESQL C source files 5 5 5 6 ESQL COBOL source files 5 5 5 6 MESSAGES category A 9 MONETARY category 1 24 NUMERIC category 1 24 sample 1 23 1 24 1 35 sending to database server 1 32 5 25 setting 1 28 TIME category 1 24 See also Client application CLIENT_LOCALE environment variable Client server environment client locale 1 32 code set conversion 1 41 1 44 database locale 1 33 locales of 1 18 1 22 server processing locale 1 34 setting environment variables 1 28 CLIENT_LOCALE environment variable client code set 1 41 default value 1 28 ESQL filenames 5 4 ESQL source code 5 4 for NLS applications 1 37 interpreting command line arguments 4 15 location of message files 2 18 precedence of 1 24 1 39 1 51 1 52 1 53 2 18 5 14 5 17 5 19 role in code set conversion 1 45 1 47 sending to database server 1 32 setting 1 28 syntax 2 7 with TEXT data 3 13 3 16 3 18 3 19 3 20 See also Client locale cm file extension A 18 A 21 cmo file extension A 18 cmZ txt file A 26 cob file extension 5 4 COBOL compiler 5 5 Code point 1 8 1 10 3 17 Code set 1252 1 8 1 19 1 21 8859 1 1 8 1 19 1 21 A 13 affecting filenames 2 27 4 10 5 5 ASCII 1 8 1 19 code points 1 8 3 17 compatible 1 6 1 27 condensed name 1 21
11. Generating Non ASCII Filenames m Your C or COBOL compiler supports the non ASCII characters that the filename of the ESOL C or ESOL COBOL source file uses If your C compiler does not support non ASCII characters you can use the CC8BITLEVEL environment variable as a workaround when your source file contains multibyte characters For more information see The esqlmf Filter on page 6 7 The GLS8BITFSYS Environment Variable The GLS8BITFSYS environment variable on the client computer tells an ESQL processor whether the operating system is 8 bit clean An ESQL processor uses the value of GLS8BITFSYS to determine whether it can use non ASCII characters in the filename of an ESQL intermediate file that it generates as follows m When GLSS8BITFSYS is 1 an ESOL processor can use non ASCII characters in filenames that it generates m When GLSS8BITFSYS is 0 an ESQL processor does not allow non ASCII characters in filenames that it generates For example suppose you compile an ESQL C source file that is called A A B B ec where ATA and B1B are multibyte characters If GLS8BITFSYS is set to 1 or is not set on the client computer an ESQL processor assumes that the operating system on the client computer is 8 bit clean and it generates an intermediate C file that is called A A7B B2 c For more information on an 8 bit clean operating system and on the GLS8BITFSYS environment variable see page 2 25 The Client Code Set When an
12. If LANG is set but LC_TIME is not the client application sets LC_TIME from the LANG value it does not send LANG to the database server LANG if DBNLS is set but LC_TIME is not set Default DATETIME format iY Y om d H M S if CLIENT_LOCALE DBTIME GL_DATETIME and DBNLS are not set For more information on these formatting directives see the description of GL_LDATE and GL_DATETIME on pages 2 27 and 2 37 respectively Informix Guide to GLS Functionality NLS Customizing Monetary Values Customizing Monetary Values The GLS locales contain end user formats which you do not usually need to change However you can set the DBMONEY environment variable to customize the appearance of the currency notation For information on the DBMONEY environment variable see the Informix Guide to SQL Reference A monetary end user format string specifies a format for the manipulation of internal DECIMAL FLOAT and MONEY values as monetary literal strings For more information see End User Formats on page 1 12 Informix products use the following precedence to determine the end user format for a MONEY value 1 DBMONEY 2 Information that the client locale defines CLIENT_LOCALE identifies the client locale if it and DBNLS are not set the client locale is the default locale 3 LC MONETARY if DBNLS is set 4 LANG if DBNLS is set but LC_ MONETARY is not set If LANG is set but LC_MONETARY is not the client
13. Informix Guide to GLS Functionality Informix Dynamic Server Version 7 3 Informix Dynamic Server with Advanced Decision Support and Extended Parallel Options Version 8 2 Informix Dynamic Server with Universal Data Option Version 9 1x Informix Dynamic Server Developer Edition Version 7 3 Informix Dynamic Server Workgroup Edition Version 7 3 INFORMIX SE Version 7 2x February 1998 Part No 000 4373 Published by INFORMIX Press Informix Software Inc 4100 Bohannon Drive Menlo Park CA 94025 1032 Copyright 1981 1998 by Informix Software Inc or its subsidiaries provided that portions may be copyrighted by third parties as set forth in documentation All rights reserved The following are worldwide trademarks of Informix Software Inc or its subsidiaries registered in the United States of America as indicated by and in numerous other countries worldwide Answers OnLine INFORMIX Informix Ilustra C ISAM DataBlade Dynamic Server Gateway NewEra All other names or marks may be registered trademarks or trademarks of their respective owners Documentation Team Twila Booth Diana Chase Signe Haugen RESTRICTED RIGHTS SPECIAL LICENSE RIGHTS Software and documentation acquired with US Government funds are provided with rights as follows 1 if for civilian agency use with Restricted Rights as defined in FAR 52 227 19 2 if for Dept of Defense use with rights as restricted by vendo
14. Tu 11 Feb 1997 m Valid monetary end user formats support the following format for the U S English amount of 354 446 02 DM354 446 02 Tip To provide this information for the client locale the locale file contains the fol lowing locale categories COLLATION CTYPE TIME MONETARY and NUMERIC For more information see Locale Categories on page A 4 The database server uses the client locale as one part of the information to determine the server processing locale for the current session For more information see Establishing a Database Connection on page 1 31 To determine the client locale Informix client applications use environment variables set on the client computer To obtain the localized order and end user formats of the client locale a client application uses the following precedence 1 DBDATE and DBTIME environment variables for the end user formats of date and time data and DBMONEY for the end user format of monetary data if one of these is set 2 GL_DATE and GL_DATETIME environment variables for the end user formats of date and time data if one of these is set 3 The information that the client locale defines CLIENT_LOCALE if it is set Informix Guide to GLS Functionality NLS NLS Locales in the Client Server Environment 4 LC environment variables for the associated category of the client locale if DBNLS is set on the client Q LC_CTYPE for the character classification info
15. cm To save disk space you might want to keep only those files that you intend to use This section describes which of these files you can safely remove from your Informix installation Removing Locale and Code Set Conversion Files You can safely remove the following GLS files from your Informix installation m For those locales that you do not intend to use you can remove locale source and object files lc and lco from the subdirectories of the lcX subdirectory in your Informix installation For more information on the IcX pathname see Locale File Subdi rectories on page A 10 m For those code set conversions that you do not intend to use you can remove code set conversion source and object files cv and cvo from the subdirectories of the evY subdirectory in your Informix installation For more information on the cvY pathname see Code Set Conversion Filenames on page A 16 Warning Do not remove the locale object file for the U S 8859 1 English locale 0333 Ico in the en_us locale file subdirectory In addition do not remove the Informix Code Set Name Mapping file registry Informix products use these files for the language processing of all locales Informix Guide to GLS Functionality UNIX Removing Code Set Files Because Informix products do not access source versions of locale and code set conversion files you can safely remove them However these files do provide useful on line docume
16. on page 2 39 You can also use the nonera based time formatting directives that the following list describes c is replaced by a special date time representation that the locale defines Fn is replaced by the value of the fraction of a second with precision that is specified by the integer n The default value of n is 2 the range of n is 0 lt n lt 5 This value overrides any width or precision between the and F character see page 2 40 GLS Environment Variables 2 37 GL_ DATETIME H_ is replaced by the hour as a decimal number 00 through 23 24 hour clock I is replaced by the hour as a decimal number 00 through 12 12 hour clock M _ is replaced by the minute as a decimal number 00 through 59 p is replaced by the AM or PM equivalent as defined in the locale r is replaced by the commonly used time representation for a 12 hour clock format including the A M or P M equivalent as defined in the locale R is replaced by the time in 24 hour notation H M S is replaced by the second as a decimal number 00 through 61 The second can be up to 61 instead of 59 to allow for the occasional leap second and double leap second T is replaced by the time in the H M S format X is replaced by the commonly used time representation as defined in the locale White space or other nonalphanumeric characters must appear between any two formatting directives If a GL_DATETIME format does
17. y m d or iy m d an internal date for March 5 1997 formats to 97 03 05 m The iY and Y formatting directives both print the year of an internal date value as a 4 digit year For example when you set GL_DATE to Y m d or iY m d the internal date for March 5 1997 formats to 1997 03 05 2 30 Informix Guide to GLS Functionality GL_DATE When an Informix product uses an end user format to scan a date the iy and iY formatting directives perform differently from y and Y respec tively The following table summarizes how the year formatting directives behave when an Informix product uses them to scan date strings Date String to Scan GL_DATE Format 1994 03 06 94 03 06 Soy Yom Yod Error Internal date for 1994 03 06 iy Yom d Internal date for 1994 03 06 Internal date for 1994 03 06 Y Yorn Yd Internal date for 1994 03 06 Internal date for 0094 03 06 iY Ym d Internal date for 1994 03 06 Internal date for 1994 03 06 In a scan of a date string the iy and y formatting directives both assume the current century for a 2 digit year However you can set the DBCENTURY environment variable to change this assumption For details see the Informix Guide to SQL Reference For more information on how Informix products use end user formats to scan and print strings see End User Formats on page 1 12 Alternative Date Formats To support alternative date formats in an end user format GL_DATE accepts
18. 1 14 1 15 2 34 2 40 sending to database server 1 32 1 39 time data 1 15 1 19 1 50 2 37 A 9 time format qualifiers 2 40 English locale 1 31 A 10 See also Default locale Environment variable CC8BITLEVEL 2 5 CLIENT_LOCALE 1 28 2 7 COLLCHAR 1 45 DBAPICODE 1 45 DBCENTURY 2 31 DBCODESET 1 37 1 39 DBDATE 2 9 DBLANG 2 16 DBMONEY 2 20 DBNLS 1 32 DBTIME 2 22 DB_LOCALE 1 28 2 19 DELIMIDENT 3 10 ESQLMF 2 24 GLS8BITFSYS 2 25 GLS related 2 4 GL_DATE 2 27 GL_DATETIME 2 37 GL_PATH 1 45 LANG 1 32 locale related 1 28 Index 5 precedence for ALS 1 26 1 38 1 40 precedence for client locale 1 24 precedence for DATE data 1 51 5 14 precedence for DATETIME data 1 51 5 17 precedence for monetary data 1 53 5 19 precedence for NLS 1 25 1 37 1 40 precedence for server processing locale 1 37 1 39 SERVER_LOCALE 1 28 2 43 See also individual environment variable names Environment variables locale 4 14 en_us 8859 1 locale Intro 4 Era based dates DATE format functions 5 8 DATETIME format functions 5 15 DBDATE formats 2 10 5 9 DBTIME formats 2 23 5 16 defined in locale A 8 definition of 1 16 extended format strings 5 10 5 16 GL_DATE formats 1 51 2 31 GL_DATETIME formats 1 51 in DELETE statement 3 51 in INSERT statement 3 51 in SQL statements 3 51 in UPDATE statement 3 51 sample 1 16 2 12 2 14 2 15 Error message DATE format 5 24 DATETIME format 5 24 GLS specific 5 24 in code set conversion 1
19. 1 26 1 49 A 12 convertible 1 29 1 46 1 48 4 6 default 1 19 1 20 1 30 definition of 1 8 determining 1 30 1 41 for client application 1 23 for database 1 26 for database server 1 27 in locale name 1 20 1 21 1 33 incompatible 1 46 multibyte 1 9 1 30 3 36 3 37 3 43 5 26 single byte 1 8 1 30 3 36 3 39 3 43 source 1 41 1 42 target 1 41 1 42 See also Client code set Code set conversion Database code set Server code set Coded Character Set Identifier CCSID See IBM CCSID code set Code set conversion by client application 1 45 by database server 1 47 character mismatches 1 42 A 17 data converted 1 48 4 6 definition of 1 41 files See Code set conversion file for blob data 1 48 4 6 6 13 for column names 1 48 4 7 for cursor names 1 48 4 7 for error message text 1 48 4 7 for LVARCHAR 4 6 for SQL data types 1 48 4 6 for SQL statements 1 48 4 6 for statement IDs 1 48 4 7 for stored procedure text 1 48 4 7 for table names 1 48 4 7 handling mismatched characters 1 42 in ESQL C program 6 12 limitations 1 41 lossy error 1 42 performing 1 43 1 47 1 48 4 6 registry file A 18 A 20 role of CLIENT_LOCALE 1 45 1 47 role of DB_LLOCALE 1 45 1 47 role of SERVER_LOCALE 1 47 two way A 16 Code set file description of A 17 listing A 26 location of A 18 A 19 object A 18 removing A 21 source A 18 Code set order See Collation order Code set conversion file description of
20. However the code set of your database locale must support this character data NCHAR columns typically store names addresses phone numbers and so on The syntax of the NCHAR data type is as follows NCHAR size In this format the size parameter specifies the number of bytes in the column The total length of an NCHAR column cannot exceed 32 767 bytes for all editions and options of Informix Dynamic Server or 32 511 bytes for SE If you do not specify size the database server assumes NCHAR 1 For the complete syntax of the NCHAR data type see the Data Type section in the Informix Guide to SQL Syntax Because the length of this column is fixed when the database server retrieves or sends an NCHAR value it transfers exactly size bytes of data If the length of a character string is shorter than size the database server extends the string with spaces to make up the size bytes If the string is longer than size bytes the database server truncates the string Informix Guide to GLS Functionality The NCHAR Data Type Collating NCHAR Data The NCHAR data type is a locale sensitive data type The only difference between NCHAR and CHAR data types is the collation order The database server collates data in NCHAR columns in localized order The database server collates data in CHAR columns in code set order For more information on collation order see The Collation Order on page 1 10 Tip The default locale U S English do
21. Loading and Unloading Data Database Server Features Using the Server Locale Performing Code Set Conversion Non ASCII Characters in Identifiers SQL Identifiers That Support Non ASCII Characters Generating Non ASCII Filenames a ar eG Naming a Database on INFORMIX SE Locale Support by Database Server Utilities Locale Environment Variables Non ASCII Characters in Command Line Arguments Support by SOL Utilities Enhancements to the onmode Utility Using the High Performance Loader Data Types for Dynamic Server with UD Option SQL 92 Data Types PAE Tae LVARCHAR Data Type Smart Large Objects Complex Data Types Opaque Data Types Distinct Data Types General SQL API Features Non ASCII Characters in ESQL Source Files Generating Non ASCII Filenames Using Non ASCII Characters in Source Code Enhanced ESQL Library Functions DATE Format Functions DATETIME Format Functions 3 35 3 41 3 41 3 41 3 42 3 44 3 46 3 48 3 49 3 50 3 50 3 51 3 51 3 52 4 3 4 5 4 8 4 9 4 13 4 14 4 14 4 15 4 18 4 19 4 19 4 20 4 21 4 22 4 22 4 23 4 23 4 26 5 4 5 4 5 6 5 7 5 8 5 15 Table of Contents v Chapter 6 Chapter 7 Appendix A Numeric Format Functions String Functions GLS Specific Error Messages Establishing a Database Connection Sending Client Locale Information Checking for Connection Warnings Avoiding Partial Characters Copying Character Data Using Code
22. The database server verifies the database locale from the information that the client sends when it requests a database server connection To perform this verification the database server compares the following two database locales m The database locale from the DB_LOCALE environment variable that the client application sends For more information see Sending the Client Locale on page 1 32 m The database locale that is stored in the system catalog of the database that the client application requests For more information see The Database Locale on page 1 26 Two database locales match if their language territory code set and any optional locale modifiers are the same If these database locales do not match the database server performs the following actions m Itsets the SQLWARN7 warning flag in the SQL Communications Area SQLCA structure For more information on how to check the SQLWARN7 warning flag see Checking for Connection Warnings on page 5 25 m It uses the database locale that is stored in the system catalog of the requested database as the database locale Warning Check for the SQLWARN7 warning flag after your ESQL client application requests a connection If the two database locales do not match the client application might incorrectly interpret data that it retrieves from the database or the database server might incorrectly interpret data that it receives from the client If you proceed wi
23. accept multibyte characters Owner Name in SQL Identifiers The owner name provides further identification of a database object within a database The ANSI term for an owner name is a schema name The ability to put non ASCII characters in the owner name portion of an identifier depends on whether your operating system supports multibyte characters in user names If your database server is on a computer with the UNIX operating system the owner name qualifier defaults to the UNIX login ID However most versions of UNIX do not support multibyte characters in the UNIX login IDs You can use multibyte characters in owner names if you explicitly specify an owner name in single quotes when you create database objects For example you can assign an owner name that contains multibyte characters when you put the owner name portion of the index name in quotes in a CREATE INDEX statement Warning If you specify multibyte characters in an owner name on a UNIX system you do so at your own risk If a UNIX login ID is used to match the owner name the match might fail The following example shows a CREATE INDEX statement that specifies a multibyte owner name In this example the owner name consists of three 2 byte characters CREATE INDEX AtA B1B2c C2 myidx ON mytable mycol The preceding example assumes that the client locale supports a multibyte code set and that Ala B B2 and C C are valid characters in this code set In
24. and date time data respectively b LC_MONETARY LC_NUMERIC and LC_TIME environment variables on the server computer for the end user formats of monetary numeric and date time data respectively c LANG environment variable on the server computer 5 DBCODESET environment variable that the client passes 6 The default locale U S English Version 9 1 or later database servers use the precedence of steps 2 3 and 6 in the preceding list to set the end user formats for the server processing locale You are not required to set the other environment variables Support for DBDATE and DBTIME provides backward compatibility for client applica tions that are based on earlier versions of Informix products Informix recommends that you use GL_DATE and GL_DATETIME for new applications GLS Fundamentals 1 39 Performing Code Set Conversion NLS ALS 1 40 Support for LANG and the LC_ environment variables provides backward compatibility for client applications that are based on Informix NLS products If DBNLS is set on the client these applications use the precedence of steps 1 4 and 6 in the preceding list to set the end user formats for the server processing locale You are not required to set CLIENT_LOCALE for NLS based applications However CLIENT_LOCALE does provide certain advantages to your application For more information see the Informix Migration Guide 4 Support for the DBCODESET environment variable provides ba
25. level Intro 20 14 Informix Guide to GLS Functionality Symbols minus sign wildcard in MATCHES clause 3 32 percent wildcard in LIKE clause 3 32 asterisk wildcard in MATCHES clause 3 32 question mark wildcard in MATCHES clause 3 32 at sign as formatting character 5 21 brackets wildcards in MATCHES clause 3 32 caret wildcard in MATCHES clause 3 32 _ underscore wildcard in LIKE clause 3 32
26. oncheck cc pc database Yes ci cI pk pK pl pL database table index_name ci cI pk pK pl pL cd cD pB pt pT pd pD pp database table onload database table Yes i old_index new_index t tape_device onlog d tape_device None onpload d source Yes Dynamic Siob Server withup 7 ail Option only p projectname onshowaudit f input_file Yes s server_name 1 of 2 Database Server Features 4 15 Non ASCII Characters in Command Line Arguments w D 4 16 produce non ASCII output Non ASCII Utility Name Non ASCII Characters in Command Line Arguments Output onspaces p pathname None f filename onstat o filename dest Yes filename_source onunload database table Yes t tape_device 2 of 2 Figure 4 3 shows utilities for Dynamic Server Workgroup and Developer Editions that accept non ASCII characters in command line arguments or Figure 4 3 Database Server Utilities That Support Non ASCII Characters Informix Guide to GLS Functionality Non ASCII Utility Name Non ASCII Characters in Command Line Arguments Output onaudit f input_file Yes oncheck cc pc database Yes ci cI pk pK pl pL database table index_name ci cI pk pK pl pL cd cD pB pt pT pd pD pp database table onload database table Yes i old_index new_index t source onlog d device None onshowaudit s server_name Yes 1 of 2 AD XP Non ASCII Characters in Command Line Arguments
27. operating systems that can support multibyte filenames For more information see Gener ating Non ASCII Filenames on page 4 9 Dynamic Server with AD and XP Options does not support non ASCII characters in filenames and pathnames An example of an SQL statement that specifies a host variable is FETCH For more information see Using Non ASCII Characters in Source Code on page 5 6 Anexample of an SQL statement that creates an index name is CREATE INDEX An example of an SQL statement that creates a role name is CREATE ROLE You cannot execute statements that are related to roles in SE An example of an SQL statement that creates a statement identifier is PREPARE For more information see Using Non ASCII Characters in Source Code on page 5 6 2 of 3 SQL Identifier Stored procedure name Stored procedure variable name Synonym name Table name Trigger corre lation name Trigger name View name References to SQL Segments SQL Segment Procedure name Expression Synonym name Table name Identifier Identifier View name Identifiers That Support Non ASCII Characters Notes An example of an SQL statement that creates a stored procedure name is CREATE PROCEDURE An example of an SQL statement that creates a stored procedure variable name is CREATE PROCEDURE An example of an SQL statement that creates a synonym name is CREATE SYNONYM An example of an S
28. sequence of characters that are delimited by quotation marks The quotation marks can be single quotes or double quotes However if the DELIMIDENT environment variable is set the database server interprets a sequence of characters in double quotes as a delimited identifier rather than as a string For more information about delimited identifiers see page 3 10 When you use a nondefault locale you can use any characters in the code set of your locale within a quoted string If the locale supports a code set with non ASCII characters you can use these characters in a quoted string In the following example the user inserts column values that include multibyte characters into the table mytable INSERT INTO mytable VALUES A A2B B2abed 123xX x2y y2 efgh In this example the first quoted string includes the multibyte characters A A and B B2 The second quoted string includes the multibyte characters X1X and Y1Y The third quoted string contains only single byte characters This example assumes that the locale supports a multibyte code set with the A A B B X X and Y Y characters For complete information on quoted strings see the Quoted String segment in the Informix Guide to SQL Syntax 3 34 Informix Guide to GLS Functionality Specifying Comments Specifying Comments To use comments after SOL statements introduce the comment text with one of the following comment symbols m The double dash complies with
29. set names or code set numbers For more information see The Informix registry File on page A 18 Most code set conversion requires two code set conversion files One file supports conversion of characters in code set A to their counterparts in code set B Another supports the conversion in the return direction from B to A Such conversions are called two way code set conversions For example the code set conversion between the CCSID 437 code set hexadecimal 01b5 code number and the CCSID 819 code set or IS08859 1 with a hexademical 0333 code number requires the following two code set conversion files m The 01b50333 cv file describes the mappings to use when Informix products convert characters in the CCSID 437 code set to those in the ISO8859 1 code set m The 033301b5 cv file describes the mappings to use when Informix products convert characters in the ISO8859 1 code set to those in the CCSID 437 code set Informix Guide to GLS Functionality UNIX Code Set Files To be able to convert between these two code sets an Informix product must be able to locate both these code set conversion object files Performing the conversion on only one direction would result in mismatched characters For more information on mismatched characters see page 1 42 The following table shows some of the code set conversions that Informix products can support along with their associated code set conversion source filenames Source Cod
30. 12 DBLANG The DBLANG environment variable specifies the subdirectory of INFORMIXDIR that contains the customized language specific message files that an Informix product uses relative_path full_path locale_name 2 16 Informix Guide to GLS Functionality DBLANG relative_path is the subdirectory of the Informix installation directory that INFORMIXDIR specifies full_path is the full pathname of the directory that contains the compiled message files locale_name is the name of a GLS locale that has the format l _tr code_set where lg is a two character name that represents the language for a specific locale tr is a two character name that represents the cultural conventions and code_set is the name of the code set that the locale supports Tip For a detailed description of the syntax of DBLANG see the Informix Guide to SQL Reference Informix products locate product specific message files in the following order 1 If DBLANG is set to a full_path the directory that full_name indicates 2 If DBLANG is set to a relative_path a In INFORMIXDIR msg DBLANG on UNIX or INFORMIXDIR msg DBLANG on Windows NT b In INFORMIXDIR DBLANG on UNIX or INFORMIXDIR DBLANG on Windows NT 3 If DBLANG is set to a locale_name the msg subdirectory for the locale in INFORMIXDIR msg I _tr code_set on UNIX systems or YINFORMIXDIR msg I _tr code_set in Windows NT environ ments where lg tr and cod
31. 17 multibyte See Multibyte character non ASCII See Non ASCII character nonprintable 3 14 3 16 partial 3 37 5 26 shifting case of 5 23 single byte See Single byte character white space See White space Character classification See Locale CTYPE category Character data avoiding corruption of 1 48 4 6 collation of 1 36 3 21 A 6 converting 1 41 1 48 4 6 data types 3 12 equivalent characters 1 11 3 24 3 29 A 6 ESQL functions 5 23 interpreting 1 26 1 36 processing with locales 1 5 See also Data Character set 1 8 A 18 Character mapping files listing A 26 Charmap files listing A 26 Charmap file See Code set file CHAR_LENGTH function 3 46 Chinese locale 1 7 1 31 chkenv utility 4 18 Chunk 4 9 Client application checking a connection 1 33 1 38 1 47 code set conversion 1 45 1 46 definition of 1 6 end user formats 1 12 establishing a connection 5 24 opening another database 1 38 1 47 requesting a connection 1 31 2 19 sending client locale to server 1 32 1 39 5 25 setting a locale 1 18 1 24 1 28 support for locales 1 6 1 7 uses of client locale 1 23 2 7 uses of database locale 1 27 verifying locales 1 45 See also ESQL C program ESQL COBOL program Client code set 1 41 1 45 1 46 Client computer client code set 1 41 code set conversion files 1 46 setting CLIENT_LOCALE 1 28 setting DB_LLOCALE 1 28 Client locale client code set 1 41 code set See Client code set COLLATION category 1 24
32. 18 Informix Guide to GLS Functionality INFORMIX GLS Features What Is INFORMIX GLS Location of Locale Information INFORMIX GLS Features INFORMIX GLS rt me Informix Products Industry Conformance 7 3 7 4 7 4 7 5 7 6 7 2 Informix Guide to GLS Functionality his chapter introduces the INFORMIX GLS application programming interface and briefly describes how it works with the Global Language Support GLS feature For complete information about how to use INFORMIX GLS see the INFORMIX GLS Programmer s Manual The INFORMIX GLS functions are also documented on line as HTML pages with Dynamic Server with UD Option What Is INFORMIX GLS INFORMIX GLS is an application programming interface API that lets DataBlade module developers and ESQL C programmers develop interna tionalized applications with a C language interface The macros and functions of INFORMIX GLS provide access within an application to GLS locales which contain culture specific information You can use INFORMIX GLS to write programs or change existing programs to handle different languages cultural conventions and code sets INFORMIX GLS Features 7 3 Location of Locale Information 7 4 Location of Locale Information All INFORMIX GLS functions access the current processing locale The current processing locale sometimes called the current locale is the locale that is currently in effect for an application It is based on one
33. 2 27 GL_DATE 2 28 GL_DATE An end user format in GL_DATE can contain the following characters m One or more white space characters which the CTYPE category of the locale specifies For more information on the CTYPE locale category see page A 6 m An ordinary character other than the symbol or a white space character m A formatting directive which is composed of the symbol followed by a conversion character that specifies the required replacement a YA ob B YoC d D Informix Guide to GLS Functionality string string is the formatting directives that specify the end user format for GL_DATE values You can use any formatting directive that formats dates For a list of the era based formatting directives see Alternative Date Formats on page 2 31 You can also use the nonera based formatting directives that the following list describes is replaced by the abbreviated weekday name as defined in the locale is replaced by the full weekday name as defined in the locale is replaced by the abbreviated month name as defined in the locale is replaced by the full month name as defined in the locale is replaced by the century number the year divided by 100 and truncated to an integer as a decimal number 00 through 99 is replaced by the day of the month as a decimal number 01 through 31 A single digit is preceded by a zero 0 is the same as the m d y format
34. 5 5 7 in cursor names 1 5 1 6 1 7 3 5 5 7 in database names 3 6 4 9 5 7 in database server filenames 4 9 in delimited identifiers 3 10 in distinct type names 4 8 4 9 in ESQL filenames 5 4 in ESQL C source files 5 6 in ESQL COBOL source files 5 6 in filenames 2 25 3 6 5 7 in host variables 1 7 3 6 5 6 6 4 in index names 3 6 4 9 in indicator variables 1 7 5 6 in literal strings 2 5 5 7 in LOAD FROM file 3 53 in opaque type names 4 8 in operator class names 4 9 in owner names 3 8 in quoted strings 3 34 in role names 3 6 in row type names 4 9 in SE filenames 2 27 in SQL comments 3 35 in statement IDs 1 5 1 6 1 7 3 6 5 7 in stored procedures 1 5 1 6 1 7 3 7 in synonym names 3 7 in table names 1 5 1 6 1 7 3 7 4 9 5 7 in triggers 3 7 in UNLOAD TO file 3 53 in view names 1 5 1 6 1 7 3 7 5 7 processing 2 5 6 8 support for 1 31 with CC8BITLEVEL 2 5 with GLS8BITFSYS 2 25 See also Multibyte character Non Gregorian calendar 1 16 Numeric data currency notation in 5 19 decimal separator 1 14 1 19 5 19 A 7 end user format 1 14 1 19 1 39 A 7 ESQL functions 5 17 format of A 7 locale specific 1 6 negative 1 15 1 19 A 7 positive 1 15 1 19 A 7 thousands separator 1 15 1 19 5 19 A 7 See also Data NUMERIC locale category alternative digits 2 33 2 40 A 7 description of A 4 A 7 end user formats 1 15 A 7 in client locale 1 24 in default locale A 5 in locale source
35. 5 8 5 9 rdefmtdate library function 5 8 5 10 rdownshift library function 5 23 registry file A 18 A 20 Regular expression 1 5 1 27 Related reading Intro 20 Relational operator conditions 3 25 Release notes Intro 19 Release notes program item Intro 19 rfmtdate library function 5 8 5 10 rfmtdec library function 5 17 rfmtdouble library function 5 17 rfmtlong library function 5 17 5 18 5 20 rofferr utility Intro 18 Role 3 6 Row data type 4 9 rstrdate library function 5 8 5 9 rupshift library function 5 23 S Sample code conventions Intro 13 SE database server See INFORMIX SE database server Search functions 3 41 secheck utility 4 18 Index 11 SELECT statement and collation order 1 10 collation of character data 3 21 3 22 embedded 3 51 LIKE keyword 3 31 MATCHES relational operator 3 29 ORDER BY clause 1 10 3 22 select list columns 6 14 specifying literal matches 3 29 3 32 specifying matches with a range 3 30 specifying quoted strings 3 34 using length functions 3 41 using TRIM 3 41 6 17 WHERE clause 1 10 3 25 selog utility 4 18 Server code set 1 41 1 47 4 10 5 5 Server computer server code set 1 41 setting DB_LOCALE 1 28 setting SERVER_LOCALE 1 28 Server locale code set See Server code set database server filenames 4 9 definition of 1 27 sample 1 23 1 28 1 35 server code set 1 41 setting 1 28 uses of 4 3 See also SERVER_LOCALE environment variable Se
36. ALS 5 0 Era Based Format The ALS 5 0 Era Based Format syntax for DBDATE provides backward compatibility with Informix ALS Version 5 0 products ALS 5 0 Era Based Format The C1 J1 and J2 era year modifiers appear as an extension at the end of the DBDATE format They indicate how to format an era as follows m The C1 era year modifier formats the era as the abbreviated era name for a Taiwanese Ming Guo date m The J1 era year modifier formats the era as the abbreviated era name for the Japanese Imperial era dates m The J2 era year modifier formats the era as the full era name for the Japanese Imperial era dates GLS Environment Variables 2 13 DBDATE The following table shows some sample era based DBDATE formats that are compatible with Informix ALS Version 5 0 products In this table the sample outputs for the Japanese Imperial era assume that the locale is ja_jp sjis Japanese SJIS The Taiwanese Ming Guo dates assume a zh_tw big5 locale Description DBDATE Setting October 5 1990 appears as Japanese Imperial era Y2MD J1 H02 10 05 Y4MD J1 H0002 10 05 Y2MD J2 A1A 02 10 05 TMD A1A20002 10 05 DMY4J2 ine 05 10 A A 0002 Taiwanese Ming Guo date Y2MD C1 79 10 05 Y4MD C1 0079 10 05 DMY4 C1 05 10 0079 ALS ALS 4 0 Era Based Format ALS 4 0 Era Based Format 2 14 eee ean N The ALS 4 0 Era Based Format syntax for DBDATE provides backward compatibility with Ascii Corporation Version 4 0 Asian
37. AZ With this DBTIME value and a Japanese client locale of ja_JP sjis a DATETIME value of December 27 1991 22 12 10 would be formatted as follows B1B2O3 12 27 22AlA 12AlA222AlA2 In the preceding example the multibyte character B1B is the full era name which the client locale must define ESQLM F The ESQLMF environment variable indicates whether the esql command automatically invokes the ESQL C multibyte filter esqlmf ESQLMF 0 2 24 Informix Guide to GLS Functionality GLS8BITFSYS When you set ESQLMF to 1 the esql command invokes esqImf to filter multibyte characters as part of the preprocessing for an ESQL C source file The value of the CC8BITLEVEL environment variable see page 2 5 deter mines the type of filtering that esqlmf performs For more information on the actions that esqlmf takes see The esqlmf Filter on page 6 7 Important For ESQLMF to take effect CCSBITLEVEL must not be set to 3 If you want to compile existing source code whose non ASCII characters have already been converted either set ESQLMF to 0 or do not set it In either case esql does not invoke esqlmf GLS8BITFSYS The GLS8BITFSYS environment variable tells an Informix product whether the operating system can support non ASCII characters in filenames When you set GLS8BITFSYS to 1 or do not set it Informix products can use non ASCII characters 8 bit or multibyte characters in the filename of an opera
38. Character Data Types The VARCHAR Data Type The VARCHAR data type stores character data in a variable length field This data can consist of letters numbers and symbols The following list summa rizes how the choice of a locale affects the VARCHAR data type The maximum size and minimum reserved space for a VARCHAR column are byte based not character based For example if you define a VARCHAR column as VARCHAR 10 6 the column has a maximum length of 10 bytes and a minimum reserved space of 6 bytes If you want to store multibyte characters in a VARCHAR column keep in mind that the total number of characters you can store in the column might be less than the total number of bytes you can store in the column Make sure to define the maximum byte size of the VARCHAR column so that it can hold enough characters for your purposes You can enter single byte or multibyte characters in a VARCHAR column The database locale must support the characters that you want to store in VARCHAR columns The database server sorts VARCHAR columns in code set order not in localized order For more information on collation order see The Collation Order on page 1 10 Within a client application always manipulate VARCHAR data in the CLIENT_LOCALE of the client application The client application performs code set conversion of VARCHAR data automatically if CLIENT_LOCALE differs from DB_LOCALE For information on code set conversion see page
39. DELIMIDENT environment variable is set the database server interprets sequences of characters in double quotes as delimited identifiers and sequences of characters in single quotes as strings This interpretation of quotes is compliant with the ANSI standard When you use a nondefault locale you can specify non ASCII characters in most delimited identifiers You can put non ASCII characters in a delimited identifier if you can put non ASCII characters in the undelimited form of the same identifier For example Figure 3 1 on page 3 5 shows that you can put non ASCII characters in an undelimited index name Thus you can put non ASCII characters in an index name that you have enclosed in double quotes to make it a delimited identifier as follows CREATE INDEX A A B B2 ON mytable mycol For the complete description of delimited identifiers see the Identifier segment in the Informix Guide to SQL Syntax Informix Guide to GLS Functionality Multibyte Characters and Identifier Length Multibyte Characters and Identifier Length An SQL database server limits the name of an SQL identifier to 18 bytes When you use multibyte characters in identifier names you must ensure that the identifier does not exceed this size requirement The name of an INFORMIX SE database is limited to 10 bytes For more information see Data Types for Dynamic Server with UD Option on page 4 20 For example the following CREATE SYNONYM statement
40. ESQL processor actually creates a file whose filename has non ASCII characters the client locale must support these non ASCII characters Before you start an Informix database server you must ensure that the code set of the client locale the client code set contains these characters When you use a nondefault locale you must set the CLIENT_LOCALE environment variable to the name of a locale whose code set contains these non ASCII characters General SQL API Features 5 5 Using Non ASCII Characters in Source Code 5 6 For example suppose you want to process an ESQL C source file with the path A A2B B2 cC c2p D2 where A A2 B B2 C c2 and DID are multibyte characters in the Japanese SJIS code set You must perform the following steps to enable the esql command to create the intermediate C source file on the client computer 1 Set the CLIENT_LOCALE environment variable on the client computer to the Japanese SJIS locale ja_jp sjis 2 Process the ESQL C source file with the esq command Once an ESQL processor creates an intermediate file it has generated a filename and written file contents in the client code set Any Informix product or client application that needs to access this file must have a client locale that supports this same code set If the code sets that are associated with the filename and with the client locale do not match a valid filename might contain illegal characters with respect to the client locale
41. Full Era Year H021005 General SQL API Features 5 11 DATE Format Functions ALS Informix Version 9 1 or later products support additional extended format strings for backward compatibility with Informix ALS products Informix recommends that you use the extended format strings that work with GLS locales see Figure 5 4 on page 5 10 in Version 9 1 or later client applications Figure 5 6 shows the extended format strings that these ESOL functions support for backward compatibility with ALS Version 5 0 products Figure 5 6 Extended Format Strings for ALS Version 5 x Compatibility Era Year Format Era Used Full era year full name of the base year yyj2 Japanese Imperial period followed by a 2 digit year offset Same as GL_DATE end user format of YEC 02 2Ey Full era year full name of the base year yyyyj2 Japanese Imperial period followed by a 4 digit year offset Same as GL_DATE end user format of YoEC 04 4Ey Abbreviated era year abbreviated name of the yycl Taiwanese Ming Guo base year period followed by a 2 digit year offset Same as GL_DATE end user format of Eg 02 2Ey yyjl Japanese Imperial Abbreviated era year abbreviated name of the yyyycl Taiwanese Ming Guo base year period followed by a 4 digit year offset Same as GL_DATE end user format of VE 04 4Ey yyyyjl Japanese Imperial 5 12 Informix Guide to GLS Functionality DATE Format Functions The following table shows some sample AL
42. Identifiers cannot use SQL reserved words as identifiers unless you on page 3 10 use them in a delimited identifier An SQL identifier can contain up to 18 bytes The only Multibyte Characters exception is that database names are limited to 10 bytes and Identifier Length in INFORMIX SE on page 3 11 3 4 Informix Guide to GLS Functionality Identifiers That Support Non ASCII Characters Identifiers That Support Non ASCII Characters If you use a nondefault locale that supports a code set with non ASCII characters you can use these non ASCII characters to form most SQL identi fiers Figure 3 1 shows the SQL identifiers that support non ASCII characters except for Dynamic Server with UD Option For additional supported SQL identifiers for Dynamic Server with UD Option see Figure 4 1 on page 4 8 In this table the SQL Identifier column lists the name of each database object The SQL Segment column shows the segment that gives the complete syntax of the identifier in the Informix Guide to SQL Syntax For more information see References to SQL Segments on page 3 7 The Notes column describes any special considerations for the identifier and also provides an example of an SQL statement that creates or uses the identifier All SQL identifiers in Figure 3 1 can be used with all Informix databases unless the Notes column indicates otherwise Figure 3 1 SQL Identifiers That Support Non ASCII Characters SQL Iden
43. If such characters exist in a quoted string the C compiler might interpret them as C language tokens which can cause compilation errors or even lost characters m The C compiler might not be 8 bit clean If a code set contains non ASCII characters with code values that are greater than 127 the C compiler must be 8 bit clean to interpret the characters To be 8 bit clean a compiler must read the eighth bit as part of the code value it must not ignore or put its own interpre tation on the meaning of this eighth bit To filter a non ASCII character the ESQL C filter converts each byte of the character to its octal equivalent For example suppose the multibyte character A AA3 has an octal representation of 160 042 244 and appears in the stcopy call stcopy AtA2A3 dest After esqlmf filters the ESQL C source file the C compiler sees this line as follows stcopy 160 042 244 dest correct interpretation Informix Guide to GLS Functionality Invoking the ESQL C Filter To handle the C language token situation the filter prevents the C compiler from interpreting the A byte octal 042 as an ASCII double quote and incor rectly parsing the line as follows stcopy Al A3 dest incorrect interpretation of A The C compiler would generate an error for the preceding line because the line has terminated the string argument incorrectly The esqlmf utility also handles the 8 bit clean situation because it pr
44. Informix Guide to SQL Syntax For a detailed explanation of the TEXT data type see the Informix Guide to SQL Reference Informix Guide to GLS Functionality Collating Character Data Collating Character Data Collation involves the sorting of the data values in columns that have character data types For an explanation of collation order and a discussion of the two methods of sorting character data code set order and localized order see The Collation Order on page 1 10 The type of collation order that the database server uses affects the following SQL statements m CREATE INDEX m SELECT Collation Order in CREATE INDEX The CREATE INDEX statement creates an index on one or more columns of a table The ASC and DESC keywords in the CREATE INDEX statement control whether the index keys are stored in ascending or descending order When you use a nondefault locale the following locale specific consider ations apply to the CREATE INDEX statement m When you create an index on a CHAR or VARCHAR column the index keys are stored in code set order For example if the database stores its database locale as the Japanese SJIS locale ja_jp sjis index keys for a CHAR column in any table of the database are stored in Japanese SJIS code set order m When you create an index on an NCHAR or NVARCHAR column the index keys are stored in localized order For example if the database is branded with the Japanese SJIS loc
45. Korean character data The client application must display French currency differently than English currency GLS Fundamentals 1 3 What Is the GLS Feature 1 4 If the Informix database server or the SQL API product included the code to perform these data dependent tasks each would need to be written specially to handle a different set of culture specific data In fact past Informix products have done that with the Asian Language Support ALS products for support of Asian multibyte data and the Native Language Support NLS feature for support of single byte non English data With support for GLS Informix products no longer need to specify how to process this culture specific information directly Culture specific infor mation resides in a GLS locale When an Informix product needs culture specific information it makes a call to the GLS library The GLS library in turn accesses the GLS locale and returns the information to the Informix product A GLS locale is a set of Informix files that bring together the information about data that is specific to a particular culture language or territory In particular a GLS locale provides the following information m The name of the code set that the application data uses m The collation order to use for character data m The format for different types of data to appear to end users For more information on a GLS locale see page 1 8 In addition the GLS feature is a more portable
46. Locale Formatted Result Gee eee Default locale en_us 8859 1 EEE German locale de_de 8859 1 DM2 1 French locale fr_fr 8859 1 aa gett A Default locale en_us 8859 1 GH g German locale de_de 8859 1 DM 2 1 g French locale fr_fr 8859 1 g BR Default locale en_us 8859 1 ssss 1 00 German locale de_de 8859 1 ssssDM1 00 French locale fr_fr 8859 1 sssss1FF Hee HE Default locale en_us 8859 1 HEE g German locale de_de 8859 1 HEHE G French locale fr_fr 8859 1 Ee PA QEF 4 Default locale en_us 8859 1 GEFFEN German locale de_de 8859 1 aa French locale fr_fr 8859 1 pprt In the preceding table the character s represents a blank or space the FF is the French currency symbol for French francs and the DM is the German currency symbol for deutsche marks For more information on locale specific currency notation see page 5 19 The DBMONEY environment variable can also set the precede currency symbol and the succeed currency symbol The syntax diagram for DBMONEY see page 2 20 refers to these symbols as front and back respec tively If set DBMONEY takes precedence over the symbols that the locale defines Informix Guide to GLS Functionality String Functions DBMONEY Extensions You can specify the currency symbol and decimal separator symbol with the DBMONEY environment variable These settings override any currency notation that the client locale specifies You can use multibyte ch
47. Set IS08859 1 es cv9 033304e4 cvo cv9 004e40333 cvo Code Set 8859 1 Code Set 1252 Examine the cvY txt file to determine the code set conversions that the INFORMIXDIR gls cvY directory on your system supports Managing GLS Files A 25 Listing Character Mapping Files Listing Character Mapping Files When you specify the cm command line option the glfiles utility creates a file that lists the available charmap files For each cmZ subdirectory in INFORMIXDIR gls glfiles creates a file in the current directory that is called cmZ txt where Z is the version number of the charmap object file format The cmZ txt file lists the character mappings in alphabetical order sorted on the name of the GLS object charmap file Figure A 5 shows a sample file cm3 txt that contains the available character mappings Figure A 5 Filename cm3 032d cn Sample glfiles File Code Set 8859 7 for Informi Filename cm3 0333 cn Character Mapping Code Set 8859 1 Files Filename cm3 0352 cn Code Set PC Latin Filename cm3 04e4 cn Code Set CP1252 Examine the cmZ txt file to determine the character mappings that the INFORMIXDIR gls cmZ directory on your system supports A 26 Informix Guide to GLS Functionality 7 bit character 8 bit character 8 bit clean 16 bit code set alpha class ALS Glossary This Glossary contains terms used in this manual For additional terms in Informix manuals see the Glossary i
48. The decimal value of the IBM CCSID number fr ofr 819 m The hexadecimal value of the IBM CCSID number fre fr 0333 When you specify a locale name with either of the first two forms Informix products use the Informix Code Set Name Mapping file to translate between code set names 8859 1 or code set number 819 to the condensed code set name 0333 For information about the file format and search algorithm that Informix products use to convert code set names to code set numbers refer to the comments at the top of the registry file When an Informix product needs to obtain information about locale aliases it accesses the GLS code set files in the following path INFORMIXDIR amp gls cmZ registry In these paths INFORMIXDIR is the environment variable that specifies the directory in which you install the Informix product gls is the subdirectory that contains the GLS files and Z represents the version number for the code set object file format Warning Do not remove the Informix Code Set Name Mapping file registry from the Informix directory Do not modify this file Informix products use this file for the language processing of all locales Managing GLS Files A 19 Removing Unused Files A 20 rN Removing Unused Files An Informix product contains the following GLS files m Locale files source lc and object 1co m Code set conversion files source cv and object cvo m Code set files source only
49. User defined procedure 4 9 Utility chkenv 4 18 database server 1 6 database server utilities 4 14 DB Access 1 6 4 18 dbexport 1 7 4 18 dbimport 4 18 dbload 4 18 dbschema 4 18 glfiles 1 21 1 46 A 21 onaudit 4 15 4 16 oncheck 4 15 4 16 onload 4 15 4 16 onlog 4 15 4 16 onmode 1 7 4 19 onpload 4 15 onshowaudit 4 15 4 16 onspaces 4 16 4 17 onstat 4 16 4 17 onunload 4 16 4 17 onutil 4 17 secheck 4 18 selog 4 18 SQL utilities 4 18 supporting multibyte characters 4 14 US English locale See Default locale V VARCHAR data type code set conversion 1 48 4 6 collation order 1 12 difference from NVARCHAR 3 15 GLS aspects 3 19 performance considerations 3 17 View 1 5 1 6 1 7 3 7 5 7 W Warnings 1 33 1 34 1 38 1 47 5 25 WHERE clause and collation order 1 10 BETWEEN condition 3 26 IN condition 3 28 in DELETE statement 3 51 in INSERT statement 3 51 in UNLOAD statement 3 51 in UPDATE statement 3 51 logical predicates 3 25 relational operator condition 3 25 Index 13 White space defined Intro 15 in formatting directives 2 28 2 30 2 37 in locale 2 28 A 6 multibyte Intro 16 single byte Intro 15 trailing Intro 16 Wildcard character 3 32 Windows environments default code set 1 19 default locale 1 21 location of message files 1 49 setting environment variables 1 29 supported code set conversions 1 46 supported locales 1 29 X X Open compliance INFORMIX GLS 7 6
50. alternative digits which the locale also defines The following table shows time formatting directives that support conversion modifiers Alternative Time Format Description Ec is replaced by a special date time representation for the era that the locale defines same as c if locale does not define an era EX is replaced by a special time representation for the era that the locale defines same as X if locale does not define an era OH is replaced by the hour in the alternative digits that the locale defines 24 hour clock same as H if locale does not define alternative digits 1 of 2 GLS Environment Variables 2 39 GL_ DATETIME Alternative Time Format Description OI is replaced by the hour in the alternative digits that the locale defines 12 hour clock same as I if locale does not define alternative digits OM is replaced by the minute with the alternative digits that the locale defines same as M if locale does not define alternative digits OS is replaced by the second with the alternative digits that the locale defines same as S if locale does not define alternative digits 2 of 2 The TIME category of the locale defines the following era information m The full and abbreviated names for an era m A special date representation for the era which the Ex formatting directive uses m A special time representation for the era which the EX formatting directive uses m A s
51. characters abc and 1 trailing space Al A2B Bt A quoted string with 2 multibyte characters 2 aA A bB B A quoted string with 2 single byte and 2 multibyte 4 characters Handling MONEY Columns The MONEY data type stores currency amounts This data type stores fixed point decimal numbers up to a maximum of 32 significant digits You can specify MONEY columns in data definition statements such as CREATE TABLE and ALTER TABLE The choice of locale affects monetary data in the following ways m The value of the default scale parameter in the definition of MONEY columns m The currency notation that the client application uses The locale defines the default scale and currency notation in the MONETARY category of the locale file For information on the MONETARY category of the locale file see The MONETARY Category on page A 7 Informix Guide to GLS Functionality Default Values for the Scale Parameter Default Values for the Scale Parameter Define a MONEY column with the following syntax MONEY precision scale Internally the database server stores MONEY values as DECIMAL values The precision parameter defines the total number of significant digits and the scale parameter defines the total number of digits to the right of the decimal separator For example if you define a column as MONEY 8 3 the column can contain a maximum of eight digits and three of these digits are to the right of the decimal separato
52. characters and symbols that format date and time values This information includes the names and abbreviations for days of the week and months of the year It also includes special representations for dates time 12 hour and 24 hour and DATETIME values These representations can include the names of eras as in the Japanese Imperial era system and non Gregorian calendars such as the Arabic lunar calendar The locale determines what calendar to use Gregorian Hebrew Arabic Japanese Imperial and so on when it scans or prints a month day or year For more information on the scan and print operations see End User Formats on page 1 12 If the locale supports era based dates and times the TIME category defines the full and abbreviated era names and special date and time representations For more information see Alternative Date Formats on page 2 31 and Alternative Time Formats on page 2 39 A 8 Informix Guide to GLS Functionality 4 NLS UNIX WIN NT Location of Locale Files This date and time information applies to the end user formats of data in DATE and DATETIME columns within a client application For example the ESQL COBOL library routine ECO DAT uses the date end user format in the TIME category of the client locale to determine how to print a date string from an internal DATE value Important Information in the TIME category does not affect the internal format of the DATE and DATETIME dat
53. characters are valid in an embedded language ESQL source file m How ESQL library functions have been enhanced to support multibyte characters and localized date and time end user formats m How to check for warnings within an ESQL application if a connection encounters locale related inconsistencies Important INFORMIX ESQL COBOL might not be supported by every version of the Informix database servers discussed in this manual For details see your Release Notes This chapter covers GLS information for both ESQL C and ESQL COBOL For information specific to ESQL C refer to Chapter 6 INFORMIX ESQL C Features Tip For descriptions of Informix SQL API features that are not unique to the GLS feature see the INFORMIX ESQL C Programmer s Manual For a discussion of INFORMIX GLS a set of C language functions procedures and macros that allow you to develop internationalized applications see the INFORMIX GLS Programmer s Manual For information about the DataBlade API a C language API that is provided with Dynamic Server with UD Option see the DataBlade API Programmer s Manual General SQL API Features 5 3 Non ASCII Characters in ESQL Source Files UNIX WIN NT Non ASCII Characters in ESQL Source Files Each Informix SQL API product contains a processor to process an ESQL source file that has embedded SQL and preprocessor statements m The ESQL C processor esql processes C source files m The ES
54. creates a synonym name of 8 multibyte characters CREATE SYNONYM AA A3B1B C C C3ID D ELE2FIF2GIG HIH2 FOR AlA B B The synonym name shown in the preceding example is 18 bytes long six 2 byte multibyte characters and two 3 byte multibyte characters so it does not exceed the maximum length for identifier names However the following CREATE SYNONYM statement generates an error because the total number of bytes in this synonym name is 20 CREATE SYNOMYM A1A2A B B2B3c c2c2p p2p3 Et EZ FL F2GtG 2HtH2 FOR ALA B BA This statement specifies four 3 byte characters and four 2 byte characters for the synonym name Even though the synonym name has only eight characters the total number of bytes in the synonym name would be 20 bytes which exceeds the maximum length for an identifier name SQL Features 3 11 Using Character Data Types 3 12 Using Character Data Types The choice of a locale can affect the way that the database server handles character data The section explains how this choice affects data in the following SQL character data types m Locale sensitive character data types NCHAR and NVARCHAR m Other character data types CHAR VARCHAR and TEXT You specify data types in data definition statements such as CREATE TABLE and ALTER TABLE The NCHAR Data Type The NCHAR data type stores character data in a fixed length field This data can be a sequence of single byte or multibyte letters numbers and symbols
55. data type built in data type named row type or another distinct data type Dynamic Server with UD Option handles GLS considerations for a distinct type as it would the source type 4 26 Informix Guide to GLS Functionality General SQL API Features Non ASCII Characters in ESQL Source Files Generating Non ASCII Filenames The GLS8BITFSYS Environment Variable The Client Code Set Using Non ASCII Characters in Source Code Enhanced ESQL Library Functions DATE Format Functions GL_DATE Support DBDATE Extensions Extended DATE Format Strings Precedence for Date End User Formats DATETIME Format Functions GL_DATETIME Support DBTIME Support Extended DATETIME Format Strings Precedence for DATETIME End User Formats Numeric Format Functions 7 Support for Multibyte Characters Locale Specific Numeric Formatting Currency Symbol Formatting DBMONEY Extensions String Functions GLS Specific Error Messages Establishing a Database Connection Sending Client Locale Information Checking for Connection Warnings Avoiding Partial Characters Copying Character Data Using Code Set Conversion 5 2 Informix Guide to GLS Functionality his chapter explains how the Global Language Support GLS feature affects the Informix Structured Query Language application programming interfaces SQL APIs INFORMIX ESQL C and INFORMIX ESQL COBOL It contains the following topics m Where multibyte
56. determines the amount of storage that each code set character requires Because a single byte can store values in the range of 0 to 255 it can uniquely identify 256 characters Most Western languages have fewer than 256 characters so their code sets consist of single byte characters When an application handles data in these code sets it can assume that one character is always stored in one byte A consortium of computer vendors tasked to create a unified worldwide code set UNICODE was integrated as part of the ISO international standard 10646 1 and is emerging as the code set choice for Microsoft operating systems Informix supports UNICODE and continues to support the diverse prevailing code sets for both compatibility reasons and the advanced processing requirements of three byte and four byte encoding schemes A series of one or more space characters The GLS locale defines the characters that are considered to be space characters For example both the TAB and blank might be defined as space characters in one locale but certain combi nations of the CTRL key and another character might be defined as space characters in a different locale file A form of a code set that involves normalizing the size of each multibyte character so that each character is the same size This size must be equal to or greater than the largest character that an operating system can support and it must match the size of an integer data type that the C compiler ca
57. esqlmf command that the ESQL C processor invokes on a ESQL C source file CC8BITLEVEL Value esqlmf Action 0 Converts all non ASCII characters in literal strings and comments to octal constants 1 Converts non ASCII characters in literal strings but not in comments to octal constants 2 Converts non ASCII characters in literal strings to octal constants to ensure that all the bytes in the non ASCII characters have the eighth bit set 3 Does not invoke esqlmf Important To invoke the esqlmf commands that CC8BITLEVEL can specify you must set the ESQLMF environment variable to 1 6 10 Informix Guide to GLS Functionality Invoking the ESQL C Filter When you set CC8BITLEVEL to 0 1 or 2 the ESQL C processor performs the following steps 1 Converts the embedded language statements source ec to C language source code source c with the ESQL C preprocessor 2 Filters non ASCII characters in the preprocessed file source c with the ESQL C filter esqlmf if the ESQLMF environment variable is 1 Before esqlmf begins filtering it creates a copy of the C source file source c that has the c_ file extension source c_ 3 Compiles the filtered C source file source c with the C compiler to create an object file source o 4 Links the object file with the ESQL C libraries and your own libraries to create an executable program When you set CC8BITLEVEL to 3 the ESQL C processor omits step 2 in the preceding list
58. for the multi_col column in a query multi_col 1 2 The query returns the following result ALA The substring that the query returns consists of 2 bytes 1 character not 2 characters Informix Guide to GLS Functionality Specifying Column Substrings To retrieve the first two characters from the multi_col column specify a column substring in which first is the byte position of the first byte in the first character and last is the byte position of the last byte in the second character For the 6 byte string AA B1B C1C you specify this column substring as follows in your query multi_col 1 4 The following result is returned A1A2B 1B The substring that the query returns consists of the first 4 bytes of the column value as you specified These 4 bytes represent the first two characters in the column Partial Characters in Column Substrings A multibyte character might consist of 2 3 or 4 bytes A multibyte character that has lost one or more of its bytes so that the original intended meaning of the character is lost is called a partial character Unless prevented a column substring might truncate a multibyte character or split it up in such a manner that it no longer retains the original sequence of bytes A partial character might be generated when you use column subscript operators on columns that contain multibyte characters Suppose that a user specifies the following column substring for the multi_col column where
59. identify the U S English locale with the ISO8859 1 code set m The locale name en_us 8859 1 uses the code set name to identify the ISO8859 1 code set m The locale name en_us 0333 uses the condensed form of the code set name to identify the ISO8859 1 code set For more information on the condensed form of a code set name see page A 16 The default locale has no locale modifier However Informix does provide the following locale that supports dictionary sort order for U S English where code_set indicates the platform specific name of the default code set en_us code_set dict A sample nondefault locale for a French Canadian locale follows frica 8859 1 You can use the glfiles utility to generate a list of the GLS locales that are available on your UNIX system For more information see The glfiles Utility on page A 21 An Informix product uses the locale name to find the corresponding GLS locale file A locale file is a runtime version of the locale information The locale name must correspond to a GLS locale file in a subdirectory of the Informix installation directory which the INFORMIXDIR environment variable indicates called gls For more information on GLS locale files see Appendix A Managing GLS Files GLS Fundamentals 1 21 Locales in the Client Server Environment Client computer Locales in the Client Server Environment When a database application runs in a client server environment the client
60. locale supports the server code set to perform the following tasks that are associated with the read and write operations to its operating system files m Perform code set conversion between the code sets of the server processing locale and the server locale m Use non ASCII characters in identifiers m Use non ASCII characters in SQL identifiers m Generate filenames that contain non ASCII characters except for Dynamic Server with AD and XP Options Performing Code Set Conversion This section summarizes the code set conversion that the database server and a client product perform For more general information see page 1 40 What Data Does the Database Server Convert Once the database server creates the operating system file it has generated a filename and written file contents in the code set of the server locale the server code set Any Informix product or client application that needs to access this file must have a server processing locale that supports this same server code set You must ensure that the appropriate locale environment variables are set so that the server processing locale supports a code set with these non ASCII characters For more information on the server processing locale see page 1 34 The database server checks the validity of a filename with respect to the server processing locale before it references a filename Dynamic Server with AD and XP Options rejects any filename that is not ASCII alph
61. m NCHAR and NVARCHAR columns are sorted in localized order Assume that you use a nondefault locale for the client and database locale and you make a query against the table called abonn s This SELECT statement specifies three columns of CHAR data type in the select list num ro employee number nom last name and pr nom first name SELECT num ro nom pr nom FROM abonn s ORDER BY nom Informix Guide to GLS Functionality Collation Order in SELECT Statements The statement sorts the query results by the values that are contained in the nom column Because the nom column that is specified in the ORDER BY clause is a CHAR column the database server sorts the query results in the code set order As Figure 3 2 shows names that begin with uppercase letters come before names that begin with lowercase letters and names that start with an accented letter lesund Etaix Otker and verst come at the end of the list Figure 3 2 Data Set for Code Set Order of the abonn Table num ro nom pr nom 13612 Azevedo Edouardo Freire 13606 Dupr Mich le Francoise 13607 Hammer Gerhard 13602 Hammerle Greta 13604 LaFor t Jean No l 13610 LeMaitre H loise 13613 Llanero Gloria Dolores 13603 Montafia Jos Antonio 13611 Oatfield Emily 13609 Tiramis Paolo Alfredo 13600 da Sousa Jo o Louren o Antunes 13615 di Girolamo Giuseppe 13601 lesund Sverre 13608 taix mile 13605 tker Hans J rgen 13614 verst Per Ande
62. msg en_us 8859 1 in Windows NT environments the message directory of the default locale for backward compatibility with Version 6 0 ALS products c In INFORMIXDIR msg on UNIX systems or INFORMIXDIR msg in Windows NT environments the default Informix message directories d In INFORMIXDIR msg english on UNIX systems or INFORMIXDIR msg english in Windows NT environ ments the message directory for the default locale of the operating system The compiled message files have the iem file extension For more informa tion on DBLANG see the Informix Guide to SQL Reference 2 18 Informix Guide to GLS Functionality DB_LOCALE DB_LOCALE The DB_LOCALE environment variable specifies the database locale which the database server uses to handle locale sensitive data types NCHAR NVARCHAR of the database For information about the database locale see The Database Locale on page 1 26 Locale Name DB_LOCALE p 1 20 Changes to DB_LLOCALE also should be reflected in the Windows NT registry database under HKEY_LOCAL_MACHINE Informix products use the DB_LOCALE environment variable for the following purposes m When a client application and a database server exchange character data the client application performs code set conversion when the value of the DB_LOCALE environment variable on the client computer is different from the value of CLIENT_LOCALE Code set conversion prevents data corruption when t
63. no effect on these formatting directives 2 of 2 For example the following formatting directive displays the minute as a decimal number with a maximum field width of 4 24M The following formatting directive displays the hour as a decimal number with a minimum field width of 3 and a maximum field width of 6 6 3H The first character of the field specification indicates whether to justify or pad the field value as follows m Ifthe first character is a minus sign an Informix product prints the field value as left justified and pads this value with spaces on the right m If the first character is a zero 0 an Informix product prints the field value as right justified and pads this value with zeros on the left m Ifthe first character is neither a minus sign nor a zero 0 an Informix product prints the field value as right justified and pads this value with spaces on the left 2 42 Informix Guide to GLS Functionality SERVER_LOCALE SERVER_LOCALE The SERVER_LOCALE environment variable specifies the server locale which the database server uses to perform read and write operations that involve operating system files on the server computer For information about the server locale see The Server Locale on page 1 27 Locale Name SERVER_LOCALE p 1 20 WIN NT Changes to SERVER_LOCALE also should be reflected in the Windows NT registry database under HKEY_LOCAL_MACHINE The database ser
64. nom values see Figure 3 2 on page 3 23 these query results do not include the following rows m Rows in which the value of nom begins with a lowercase letter da Sousaand di Girolamo Rows with an accented letter lesund Etaix Otker and verst However if nom is an NCHAR column the database server uses localized order to sort the rows The following sample output shows the query results num ro nom pr nom 13612 Azevedo Edouardo Freire 13601 Alesund Sverre 13600 da Sousa Joao Louren o Antunes 13615 di Girolamo Giuseppe 13606 Dupr Mich le Francoise 13608 Etaix Emile 13607 Hammer Gerhard 13602 Hammerle Greta 1 of 2 SQL Features 3 27 Collation Order in SELECT Statements 3 28 num ro nom pr nom 13604 LaFor t Jean No l 13610 LeMaitre H loise 13613 Llanero Gloria Dolores 13603 Monta a Jos Antonio 13611 Oatfield Emily 13605 tker Hans J rgen 13614 verst Per Anders 13609 Tiramis Paolo Alfredo 2 of 2 Because the database server uses localized order for the nom values these query results include rows in which the value of nom begins with a lowercase letter or accented letter IN Conditions An IN condition is satisfied when the expression to the left of the IN keyword is included in the parenthetical list of values to the right of the keyword This SELECT statement assumes a nondefault locale and uses an IN condition to retrieve only those rows in which the value of the nom
65. nondefault locale you must set the DB_LOCALE environment variable m Ifa database utility causes the database server to write data on the server computer that has a nondefault code set you must set the SERVER_LOCALE environment variable These utilities also perform code set conversion if the database and the client locales support convertible code sets For more information on code set conversion see page 1 40 For more information on these environment variables see Chapter 2 GLS Environment Variables Changes to locale environment variables also should be reflected in the Windows NT registry database under HKEY_LOCAL_MACHINE 4 14 Informix Guide to GLS Functionality Non ASCII Characters in Command Line Arguments Non ASCII Characters in Command Line Arguments Most database server utilities support non ASCII characters in command line arguments These utilities interpret all command line arguments in the client code set which CLIENT_LOCALE defines For more information about these utilities see your Administrator s Guide Figure 4 2 shows utilities for Informix Dynamic Server and Informix Dynamic Server with Universal Data Option that accept non ASCII characters in command line arguments or produce non ASCII output Figure 4 2 Database Server Utilities That Support Non ASCII Characters Non ASCII Utility Name Non ASCII Characters in Command Line Arguments Output onaudit f input_file Yes
66. of output shows that this SELECT statement retrieves six rows num ro nom pr nom 13612 Azevedo Edouardo Freire 13601 Alesund Sverre 13600 da Sousa Jo o Louren o Antunes 13615 di Girolamo Giuseppe 13606 Dupr Mich le Fran oise 13608 taix mile These six rows are those less than Hammer in the localized order data set shown in Figure 3 3 on page 3 24 BETWEEN Conditions The following SELECT statement assumes a nondefault locale and uses a BETWEEN condition to retrieve only those rows in which the values of the nom column are in the inclusive range of the values of the two expressions that follow the BETWEEN keyword SELECT num ro nom pr nom FROM abonn s WHERE nom BETWEEN A AND Z The query result depends on whether nom is a CHAR or NCHAR column If nom is a CHAR column the database server uses the code set order of the default code set to retrieve the rows that the WHERE clause specifies The following sample output shows the query results num ro nom pr nom 13612 Azevedo Edouardo Freire 13606 Dupr Mich le Fran oise 13607 Hammer Gerhard 1 of 2 Informix Guide to GLS Functionality Collation Order in SELECT Statements num ro nom pr nom 13602 Hammerle Greta 13604 LaFor t Jean No l 13610 LeMaitre H loise 13613 Llanero Gloria Dolores 13603 Monta a Jos Antonio 13611 Oatfield Emily 13609 Tiramis Paolo Alfredo 2 of 2 Because the database server uses the code set order for the
67. of the following environments m The client environment ESQL C creates client applications Therefore the current processing locale for ESQL C applications is the client locale The current processing locale for client LIBMI applications is also the client locale m The database that the database server is currently accessing The current processing locale for DataBlade server routines is the server processing locale which the database server determines from the client database and server locales INFORM IX GLS Features You can use INFORMIX GLS functions to create internationalized applica tions The goal of internationalization is to create or modify an application so that you need only point the application to the correct GLS locale to support a different language territory and code set INFORMIX GLS provides macros and functions to help you perform the following internationalization tasks m Process single byte multibyte and wide characters INFORMIX GLS functions perform character classification case conversion and code set conversion These functions access the current processing locale to determine character classes and character case m Process single byte multibyte and wide character strings INFORMIX GLS functions perform string traversal string concate nation copying length determination and character searching These functions access the current processing locale and its code set to determine the
68. on LIKE see the Condition Segment in the Informix Guide to SQL Syntax SQL Features 3 31 Collation Order in SELECT Statements The LIKE condition can specify only a literal match For literal matches the data type of the column determines whether collation considerations come into play as follows m For CHAR and VARCHAR columns no collation considerations come into play m For NCHAR and NVARCHAR columns collation considerations might come into play because these data types use localized order and the locale might define equivalence classes of collation For example the localized order might specify that a and A are an equivalent class For more information see the description of literal matches with the MATCHES condition on page 3 29 The LIKE keyword does not support matches with a range That is you cannot use bracketed wildcard characters in LIKE conditions Wildcard Characters in LIKE and MATCHES Conditions Informix products support the following ASCII characters as wildcard characters in the MATCHES and LIKE conditions Clause Wildcard Characters LIKE _ MATCHES 4 3 32 Informix Guide to GLS Functionality Collation Order in SELECT Statements For CHAR and VARCHAR data the database server performs byte by byte comparison for pattern matching in the LIKE and MATCHES conditions For NCHAR and NVARCHAR data the database server performs pattern matching in the LIKE and MATCHES condition
69. precedence of environment variables 1 53 5 19 thousands separator 1 15 1 19 3 50 5 19 A 7 See also Data MONEY data type MONETARY locale category currency symbol 5 21 description of A 4 A 7 end user formats 1 15 A 7 in client locale 1 24 in default locale A 5 in locale source file A 12 in server processing locale 1 40 numeric formatting functions 5 19 MONEY data type defining 3 48 end user format 1 14 2 20 internal format 1 14 1 53 3 49 precedence of environment variables 1 53 5 19 See also Monetary data Multibyte character column substrings 3 36 definition of 1 9 filtering 6 8 in cast names 4 8 in column names 1 5 1 6 1 7 3 5 5 7 in comments 2 5 5 7 in connection names 3 5 in constraint names 3 5 5 7 in cursor names 1 5 1 6 1 7 3 5 5 7 in database names 3 6 4 9 5 7 in database server filenames 4 7 4 9 in database server utilities 4 14 in delimited identifiers 3 10 in distinct type names 4 8 in ESQL filenames 5 4 in ESQL C source files 5 6 in ESQL COBOL source files 5 6 10 Informix Guide to GLS Functionality in filenames 1 31 2 25 3 6 4 9 5 7 in function names 4 8 in host variables 1 7 3 6 5 6 6 4 in index names 3 6 4 9 in indicator variables 1 7 5 6 in literal strings 2 5 5 7 in LOAD FROM file 3 53 in NCHAR columns 3 13 in numeric formats 5 18 in NVARCHAR columns 3 16 in opaque type names 4 8 in operator class names 4 9 in owner names 3 8 in procedure names 4 9 in
70. quoted strings 3 34 in role names 3 6 in row type names 4 9 in SE filenames 2 27 4 12 in SQL comments 3 35 in SQL identifiers 3 5 4 8 in statement IDs 1 5 1 6 1 7 3 6 5 7 in stored procedures 1 5 1 6 1 7 3 7 in synonym names 3 7 in table names 1 5 1 6 1 7 3 7 4 9 5 7 in triggers 3 7 in UNLOAD TO file 3 53 in view names 1 5 1 6 1 7 3 7 5 7 partial characters 3 37 5 26 processing 2 5 6 8 representation of Intro 14 shifting case of 5 24 SQL examples Intro 15 support by C compiler 6 8 support for 1 4 1 31 with CC8BITLEVEL 2 5 with DBTIME 2 24 with GLS8BITFSYS 2 25 See also Non ASCII character N Native Language Support NLS code set conversion with 1 45 collation order 1 12 establishing a connection 1 34 information in systables 1 26 precedence of environment variables 1 25 1 37 1 40 reverting to 4 19 single byte data 1 4 NCHAR data type code set conversion 1 48 4 6 collation order 1 12 3 13 description of 3 12 difference from CHAR 3 13 in ESQL C program 6 6 in regular expressions 1 5 inserting into database 6 6 multibyte characters 3 13 nonprintable characters 3 14 performance considerations 3 17 sizing 3 12 with numeric values 3 14 NLS See Native Language Support NLS Non ASCII character definition of 1 9 examples 1 30 filtering 6 8 in cast names 4 8 in column names 1 5 1 6 1 7 3 5 5 7 in comments 2 5 5 7 in connection names 3 5 in constraint names 3
71. specify a column substring for a column with the BYTE or TEXT data type The database server avoids partial characters in BYTE and TEXT columns in the following way m Because the database server interprets a BYTE column as a series of bytes not characters the splitting of multibyte characters as a result of the byte range that a column substring specifies is not an issue A column substring for a BYTE column returns the exact range of bytes that is specified and does not replace any bytes with white spaces m The database server interprets a TEXT column as a series of characters A column substring for a TEXT column returns the exact range of bytes that is specified Attempts to resolve partial characters in TEXT data are resource intensive Therefore the database server does not replace any bytes with white spaces For more information on the TEXT data type see page 3 19 Warning Because your application handles the interpretation of BYTE and TEXT data it must handle possible occurrences of partial characters in multibyte simple large object blob data 3 40 Informix Guide to GLS Functionality Specifying Arguments to the TRIM Function Specifying Arguments to the TRIM Function The TRIM function is an SQL function that removes leading or trailing pad characters from a character string By default this pad character is an ASCII space If your locale supports a code set that defines a different character as a space TRI
72. the ANSI SQL standard m Curly brackets are an Informix extension to the standard When you use a nondefault locale you can use any characters in the code set of your locale within a comment If the locale supports a code set with non ASCII characters you can use these characters in an SQL comment In the following example the user inserts a column value that includes multibyte characters into the table mytable EXEC SQL insert into mytable values AtA2B B2abcd 123 AA and B B are multi byte characters In this example the SQL comment includes the multibyte characters Ala and B B This example assumes that the locale supports a multibyte code set with the A A and B B characters For complete information on SQL comments and comment symbols see the Introduction to the Informix Guide to SQL Syntax Specifying Column Substrings When you specify a column expression with a character data type ina SELECT statement or in any other SQL statement that includes an embedded SELECT statement you can specify that a subset of the data in the column is to be retrieved A column expression that includes brackets to signify a subset of the data in the column is known as a column substring The syntax of a column substring is as follows column_name first last In this format first is the position of the first byte in the substring and last is the position of the last byte in the substring For the complete syntax of colu
73. the WHERE clause SELECT FROM tabl WHERE coll gt bob SELECT FROM tabl WHERE site BETWEEN abc AND xyz m Sorted data that the ORDER BY clause creates SELECT FRO tabl ORDER BY coll m Comparisons in MATCHES and LIKE clauses SELECT FROM tabl WHERE coll MATCHES al SELECT FROM tabl WHERE coll LIKE dog SELECT FROM tabl WHERE coll MATCHES abc a z For more information on how choice of a locale affects the SELECT statement see Collation Order in SELECT Statements on page 3 22 Informix database servers support the following two methods of collation of character data m Code set order Localized order Code Set Order Code set order refers to the bit pattern order of characters within a code set The order of the code points in the code set determines the sort order For example in the ASCII code set A 65 and B 66 The character A always sorts before B because a code point of 65 is less than one of 66 However because a 97 and M 77 the string abc sorts after Me which is not always the preferred result The database server sorts data in CHAR VARCHAR and TEXT columns in code set order All code sets that Informix products support include the ASCII characters as the first 127 characters Therefore other characters in the code set have the code points 128 and greater When the database server sorts data in a CHAR VARCHAR or TEXT column it puts chara
74. the catalog table is a TEXT column and this column contains the string Ludwig the result is 6 If the cat_descr column contains the string Ludwigssss the result is 10 If the procedure variable f_name is defined as CHAR 15 and this variable contains the string Ludwig the result is 6 If the f_name variable contains the string Ludwigssss the result is 10 The CHAR_LENGTH function is especially useful with multibyte code sets If a quoted string of characters contains any multibyte characters the number of characters in the string differs from the number of bytes in the string You can use the CHAR_LENGTH function to determine the number of characters in the quoted string SQL Features 3 47 Handling MONEY Columns 3 48 However the CHAR_LENGTH function can also be useful in single byte code sets In these code sets the number of bytes in a column is equal to the number of characters in the column If you use the LENGTH function to determine the number of bytes in a column which is equal to the number of characters in this case LENGTH trims the column values and returns the length of the trimmed string In contrast CHAR_LENGTH does not trim the column values but returns the actual size of the column The following table shows some results that the CHAR_LENGTH function might generate for quoted strings CHAR_LENGTH Input String Description Result abc A quoted string with 4 single byte characters the 4
75. the following conversion modifiers m E indicates use of an alternative era format which the locale defines m 0 the letter O indicates use of alternative digits which the locale also defines GLS Environment Variables 2 31 GL_DATE 2 32 The following table shows date formatting directives that support conversion modifiers Alternative Date Format Description WEC Accepts either the full or the abbreviated era name for scanning for printing EC is replaced by the full name of the base year period of the era that the locale defines same as C if locale does not define an era Eg Accepts either the full or the abbreviated era name for scanning for printing Eg is replaced by the abbreviated name of the base year period of the era that the locale defines same as C if locale does not define an era EX Is replaced by a special date representation for an era that the locale defines same as x if locale does not define an era Ey Is replaced by the offset from EC of the era that the locale defines This date is the era year only same as y if locale does not define an era EY Is replaced by the full era year which the locale defines same as Y if locale does not define an era Od Is replaced by the day of the month in the alternative digits that the locale defines same as d if locale does not define alternative digits Oece Is the same as Od same as e if locale does not define alternative digi
76. the value of the string in multi_col is A A B B7C C multi_col 2 5 The user requests the following bytes in the query A B BC However if the database server returned this column substring to the user the first and third characters in the column would be truncated Avoidance in a Multibyte Code Set Informix database servers do not allow partial characters to occur The GLS feature prevents the database server from returning the specified range of bytes literally when this range contains partial characters If your database locale supports a multibyte code set and you specify a particular column substring in a query the database server replaces any truncated multibyte characters with single byte white spaces SQL Features 3 37 Specifying Column Substrings 3 38 For example suppose the multi_col column contains the string A A A3A4B B2B B4 and you execute the following SELECT statement SELECT multi_col FROM tablename WHERE multi_col 2 4 AtA B B2 The query indicates that no matching rows were found because the database server converts the substring multi_col 2 4 the string A2A A to three single byte spaces sss The WHERE clause of the query specifies the following condition for the search WHERE sss A1AZA3 Because this condition is never true the query retrieves no matching rows Informix database servers replace partial characters in each individual substring operation even when they are co
77. utilities provide support for the GLS feature How the high performance loader supports non ASCII characters How multibyte characters affect the name of a database How the GLS feature might affect Dynamic Server with UD Option data types For descriptions of database server features that are not unique to the GLS feature see your Administrator s Guide For an introduction to the GLS feature see Chapter 1 GLS Fundamentals Using the Server Locale The database server might perform read and write operations to the following operating system files Diagnostic files The database server generates diagnostic files when you set one or more of the following configuration parameters DUMPCNT DUMPCORE DUMPDIR DUMPGCORE and DUMPSHMEM Diagnostic files include the af xxx shmem xxx gcore xxx and core files Message log file The database server generates a user specified message log file when you set the MSGPATH configuration parameter Database Server Features 4 3 Using the Server Locale w D AD XP When you set the MSGPATH configuration parameter Dynamic Server Workgroup and Developer Editions writes status messages and diagnostic messages to the file Y INFORMIXDIR online log and performs reads of the file The INFORMIX SE database server creates operating system files for the following objects m Database When SE creates a database it creates a subdirectory that is called dbname dbs in yo
78. way to support culture specific information Many operating systems provide support for non English data However this support is usually in a form that is specific to the operating system Not many standards yet exist for the format of culture specific infor mation This lack of conformity means that if you move an application from one operating system environment to another you might need to change the way in which the application requests language support from the operating system You might even might find that the new operating system environment does not provide the same aspect of language support that the initial environment provided Informix products support the GLS feature Therefore they can access culture specific information regardless of the operating system under which they run They can locate the locale information on any platform to which they are ported Informix Guide to GLS Functionality GLS Support by Informix Products GLS Support by Informix Products Informix provides GLS support in the following types of products and utilities m Informix database servers m Informix client applications and database server utilities m The INFORMIX GLS application programming interface The following sections outline the features that GLS support provides for the first two types of Informix products For information about INFORMIX GLS see Chapter 7 INFORMIX GLS Features Informix Database Servers With the GLS fe
79. 1 locale See Locale file log 1 27 4 3 4 4 message 1 28 1 44 1 49 2 16 name of See Filename registry A 18 A 20 SE data 4 4 SE index 4 4 sqexplain out 1 27 text 3 52 UNLOAD TO 3 53 File extension c 5 4 6 11 cm A 18 A 21 cmo A 18 cob 5 4 cv 1 42 A 15 A 20 cvo A 15 A 20 c_ 6 11 dat 4 4 dbs 4 4 ec 5 4 6 11 eco 5 4 idx 4 4 iem 2 18 lc A 11 A 12 A 15 A 20 lco A 11 A 20 0 6 11 Filename 7 bit clean 2 26 8 bit 4 12 8 bit clean 2 26 4 12 5 5 generating 2 25 4 9 5 4 illegal characters in 2 26 multibyte See Filename non ASCII non ASCII 2 25 3 6 4 7 4 9 5 4 5 7 validating 4 5 finderr utility Intro 18 FLOAT data type 1 14 1 53 A 7 Formatting directive conversion modifier 1 51 conversion modifiers 2 32 field precision 2 35 2 41 field specification 2 34 2 35 2 41 field width 2 35 2 41 white space 2 30 with DBTIME 2 23 with GL_DATE 2 28 with GL_DATETIME 2 37 Format See End user format French locale 1 13 1 14 1 21 1 31 1 33 1 38 1 47 A 10 Functions case sensitive 3 41 G Gateways and GLS 1 45 Gengo year format 1 17 German locale 1 24 1 27 1 31 A 10 glfiles utility charmap files A 26 cm option A 22 A 26 code set files A 26 code set conversion files 1 46 A 25 cv option A 22 A 25 lc option A 22 locale files 1 21 A 22 sample output A 23 A 24 A 25 A 26 syntax A 21 Global Language Support See GLS environment GLS en
80. 1 40 For the syntax of the VARCHAR data type see the Informix Guide to SQL Syntax For a detailed explanation of the VARCHAR data type see the Informix Guide to SQL Reference SQL Features 3 19 Other Character Data Types 3 20 The TEXT Data Type The TEXT data type stores any kind of text data TEXT columns typically store memos manual chapters business documents program source files and other types of textual information The following list summarizes how the choice of a locale affects the TEXT data type m The database server stores character data in a TEXT column in the code set of the database locale m You can enter single byte or multibyte characters in a TEXT column The database locale should support the characters that you want to store in TEXT columns However you can put any type of character in a TEXT column m Text columns do not have an associated collation order The database server does not build indexes on TEXT columns Therefore it does not perform collation tasks on these columns For more information on collation order see The Collation Order on page 1 10 m Within a client application always manipulate TEXT data in the CLIENT_LOCALE of the client application The client application performs code set conversion of TEXT data automatically if CLIENT_LOCALE differs from DB_LOCALE For information on code set conversion see page 1 40 For the complete syntax of the TEXT data type see the
81. 48 4 7 numeric format 5 24 Error message files Intro 18 Escape character 3 33 esql command See ESQL C processor ESQL library functions currency notation in 5 19 5 21 DATE format functions 5 8 6 Informix Guide to GLS Functionality DATETIME format functions 5 15 GLS enhancements 5 7 GLS error messages 5 24 numeric format functions 5 17 string functions 5 23 ESQL program See ESQL C program ESQL COBOL program esqlc command See ESQL C preprocessor esqlcobol command See ESQL COBOL processor ESQLMF environment variable 2 24 6 10 esqlmf filter See ESQL C filter ESQL C compiler See also C compiler ESQL C data types 1 48 4 6 6 5 ESQL C filter description of 6 7 invoking 6 9 non ASCII characters 6 8 with CC8BITLEVEL 2 5 6 10 with ESQLMF 2 24 6 10 ESQL C function library DATE format functions 5 8 5 9 5 10 DATETIME format functions 5 15 dtcvfmtasc 5 15 dttofmtasc 5 15 era based dates 5 9 5 10 precedence for DATE data 5 14 precedence for DATETIME data 5 17 precedence for MONEY data 5 19 rdatestr 5 8 5 9 rdefmtdate 5 8 5 10 rdownshift 5 23 rfmtdate 5 8 5 10 rfmtdec 5 17 rfmtdouble 5 17 rfmtlong 5 17 5 18 5 20 rstrdate 5 8 5 9 rupshift 5 23 ESQL C library functions rdatestr 1 13 ESQL C preprocessor 2 7 6 7 ESQL C processor definition of 5 4 invoking ESQL C filter 2 6 6 10 multibyte characters 2 27 5 4 non ASCII filenames 2 27 5 4 non ASCII source code 6 10 operat
82. A 14 listing 1 46 A 25 location of A 15 object A 15 A 20 removing unused A 20 source 1 42 A 15 A 20 Collation definition of 1 10 equivalence classes 1 11 3 24 3 29 3 32 A 6 of character data 3 21 of NCHAR 3 13 of NVARCHAR 3 15 sort order See Collation order with ALS database server 1 12 1 26 with NLS database server 1 12 1 26 COLLATION locale category description of A 4 A 6 in client locale 1 24 in default locale A 4 in locale source file A 12 in server processing locale 1 38 Collation order code set 1 10 1 12 3 17 localized 1 5 1 11 1 12 1 20 1 36 3 17 tasks affected by 1 10 types of 1 10 COLLCHAR environment variable 1 45 Column database expressions 3 35 in code set conversion 1 48 4 7 naming 1 5 1 6 1 7 3 5 5 7 substrings 3 35 3 40 Command line arguments 4 15 Command line conventions elements of Intro 10 example diagram Intro 12 how to read Intro 12 Comment icons Intro 7 Comments 2 5 3 35 5 7 Compiler See C compiler ESQL C compiler Compliance icons Intro 9 Compliance with industry standards Intro 20 7 6 Conditions BETWEEN 3 26 IN 3 28 LIKE 3 31 MATCHES 3 29 relational operator 3 25 CONNECT statement 3 5 Connection See Database server connection Constraint 3 5 5 7 Conversion modifier 1 51 2 31 2 39 CREATE CAST statement 4 8 CREATE DATABASE statement 3 6 CREATE DISTINCT TYPE statement 4 8 CREATE FUNCTION statement 4 8 CREATE INDEX statement 3 4 3 6 3 21 CREATE OPA
83. AR and NVARCHAR see Using Character Data Types on page 3 12 It automatically interprets locale specific formatting for date and time data and for monetary data For more information see End User Formats on page 1 12 Database Server Features 4 21 LVARCHAR Data Type 4 22 LVARCHAR Data Type The LVARCHAR data type is also used to represent the format of a base type value LVARCHAR is similar to the Informix specific data type VARCHAR VARCHAR stores character data of varying length m The LVARCHAR data type supports values greater than 256 bytes m The LVARCHAR data type is collated in code set collation order m Client applications perform code set conversion on LVARCHAR data For more information on code set collation and conversion see Chapter 1 GLS Fundamentals The LVARCHAR data type supports SQL length functions similar to the VARCHAR data type For more information see Using SQL Length Functions on page 3 41 For more information on the LVARCHAR data type see the Informix Guide to SQL Reference Smart Large Objects A smart large object can store text or images Smart large objects are stored and retrieved in pieces and have database properties such as crash recovery and transaction rollback Dynamic Server with UD Option supports the following two smart large object data types m The BLOB data type stores any type of binary data including images and video clips m The CLOB
84. CHAR sent to the server A mode for tools that have not been modified to process NLS data according to the rules of a locale and have not been modified to support the NCHAR and NVARCHAR data types In this mode the database server allows the client to connect to any database regardless of the locale of the database When NCHAR and NVARCHAR data is sent from the database server to the client application the database server converts it to CHAR and VARCHAR data respectively When CHAR and VARCHAR data is sent from the client to the database server the database server converts it to NCHAR and NVARCHAR data respectively This mode is enabled when the client sets DBNLS 2 and COLLCHAR 1 Glossary 5 IMPLICIT NLS EXPLICIT NLS partial character server locale server processing locale A mode for tools that have been modified to process NLS data according to the rules of a locale but have not been modified to support the NCHAR and NVARCHAR data types In this mode the locale that the client uses must equal the locale used by the database to which the client is trying to connect When NCHAR and NVAR CHAR data is sent from the database server to the client application the server converts it to CHAR and VARCHAR data respectively When CHAR and VARCHAR data is sent from the client to the database server the database server converts it to NCHAR and NVARCHAR data respectively This mode is enabled when the client sets DBNLS 1 and COL
85. ESSAGES Locale Category Locale Categories A GLS locale file groups locale specific information into the six locale catego ries that the following table shows Description Controls the behavior of character classification and case conversion Controls the behavior of string comparisons Controls the behavior of non monetary numeric end user formats Controls the behavior of currency end user formats Controls the behavior of date and time end user formats Controls the definitions of affirmative and negative responses to messages The CTYPE and COLLATION categories primarily affect how the database server stores and retrieves character data in a database The NUMERIC MONETARY and TIME categories affect how a client application formats the internal values of the associated SQL data types The default locale U S English provides the following behavior for each of the locale categories In Default Locale U S English The default code set classifies characters The default code set is ISO8859 1 The default code set is Microsoft 1252 CTYPE UNIX WIN NT COLLATE A 4 Informix Guide to GLS Functionality The default locale does not define a localized order Therefore the database server collates NCHAR and NVARCHAR data in code set order 1 of 2 Locale Category NUMERIC Locale Categories In Default Locale U S English The following numeric notation for use in numeric end user f
86. ETARY page A 7 TIME LC_TIME page A 8 MESSAGES LC_MESSAGES page A 9 Locale Filenames To conform to DOS 8 3 naming conventions a GLS locale file uses a condensed form of the code set name codemodf in its filenames The 4 character code name of each locale file is the hexadecimal representation of the code set number for the code set that the locale supports The 4 character modf name is the optional locale modifier A 12 Informix Guide to GLS Functionality UNIX Location of Locale Files For example the IS08859 1 code set has an IBM CCSID number of 819 in decimal and 0333 in hexadecimal Therefore the 4 character name of a locale source file that supports the IS08859 1 code set is 0333 1c The following table shows some code sets and locale modifiers that Informix products can support along with their associated locale source filenames Code Set Locale Modifier Locale Source File 1S08859 1 IBM CCSID 819 none 0333 1c Dictionary 0333dict Ic Microsoft 1252 West Europe none 04e4 1c Dictionary 04e4dict lc IBM CCSID 850 none 0352 1c Dictionary 0352dict Ic A French locale that supports the ISO8859 1 code set has a GLS locale that is called 0333 1c file in the fr_fr locale file subdirectory The default locale U S English also uses the ISO8859 1 code set on UNIX platforms a locale file that is called 0333 1c is also in the en_us locale file subdirectory Because both the French and U S English locales support the M
87. HAR DESCRIBE returns the data type of the trimmed column as SQOLNVCHAR Important TRIM does not support the LVARCHAR data type in Dynamic Server with UD Option The following SELECT statement contains the manu_code column which is defined as a CHAR data type and the cat_advert column which is defined as a VARCHAR column When you describe the following SELECT statement and use the TRIM function with an Informix database server other than INFORMIX SE DESCRIBE returns a data type of SQLVCHAR for both trimmed columns SELECT TRIM manu_code TRIM cat_advert FROM catalog INFORMIX ESQL C Features 6 17 Using the TRIM Function If the manu_code column is defined as NCHAR instead DESCRIBE returns a data type of SQLNVCHAR for this trimmed column For INFORMIX SE the DESCRIBE statement returns the same data type as the source character value expression When you dynamically execute the following SELECT statement with an SE database server the DESCRIBE statement returns a data type of SQLCHAR the same data type as the select list column manu_code the source character value expression SELECT TRIM manu_code FROM manufact Important The sqltypes h header file defines the data type constants SQLCHAR SQLVCHAR and SQLNVCHAR You must include this header file in your ESQL C source file in order to use these constants For more information on the sqltypes h header file see the INFORMIX ESQL C Programmer s Manual 6
88. IME category of the locale file defines the end user formats for date and time data For more information on the TIME category see page A 8 Tip To customize the end user formats that the locale defines for date and time values you can use the GL_LDATE and GL_DATETIME environment variables For more information see Customizing Date and Time End User Formats on page 1 50 GLS Fundamentals 1 17 How Do You Set a GLS Locale 1 18 How Do You Set a GLS Locale Ina client server environment both the database server and the client appli cation must know which language the data is in to be able to process the application data correctly The language affects database server tasks such as sorting collation and comparison It also affects client tasks such as end user formats and alphabetic case conversion A GLS locale identifies the code set the collation sequence character classifi cation for comparisons and end user formats of monetary numeric date and time data For the database server and the client application to commu nicate successfully you must establish the appropriate GLS locales for your environment This section describes the following topics A default locale The format of a GLS locale name The locales that you must establish for Informix products How to establish a nondefault locale The Default Locale Informix products use U S English as the default locale This locale specifies the foll
89. LCHAR 1 A mode for tools that have been modified to process NLS data according to the rules of a locale and have been modified to support the NCHAR and NVARCHAR data types In this mode the locale that the client uses must equal the locale used by the database to which the client is trying to connect This mode is enabled when the client sets DBNLS 1 and COLLCHAR 0 The following environment variable settings are correct but they do not allow access to any NLS features DBNLS 0 and COLLCHAR 0 If you do not set these variables the default is 0 The following environment variable settings are not valid DBNLS 0 and COLLCHAR 1 and DBNLS 2 and COLLCHAR 0 A multibyte character that has lost one or more bytes so that the intended meaning of the character is lost GLS software provides context specific solu tions that prevent partial characters from being generated during string processing operations The locale with which the server performs input and output For example files that are written and read with respect to the locale that the SERVER_LOCALE environment variable specifies The environment that the database server dynamically determines based on the client locales and information that is stored in the database being accessed 6 Informix Guide to GLS Functionality single byte character UNICODE white space wide character A character that has one byte of storage The number of unique characters in the language
90. M does not remove this locale specific space from the front or back of a string If you specify the LEADING TRAILING or BOTH keywords for TRIM you can define a different pad character However you cannot specify a non ASCII character as a pad character even if your locale supports a code set that defines the non ASCII character Using Case Insensitive Search Functions In Version 7 3 the SQL functions UPPER LOWER and INITCAP support GLS They accept multibyte characters in character type source strings and operate on them The return type is the same as the type of the source string m UPPER converts every letter in a string to uppercase m LOWER converts every letter in a string to lowercase m INITCAP changes the first letter of a word or series of words into uppercase For complete information about these search functions see the Informix Guide to SQL Syntax Using SQL Length Functions You can use SQL length functions in the SELECT statement and other data manipulation statements Length functions return the length of a column string or variable in bytes or characters The choice of locale affects the following three SQL length functions m The LENGTH function m The OCTET_LENGTH function m The CHAR LENGTH or CHARACTER_LENGTH function SQL Features 3 41 The LENGTH Function LENGTH Argument For the complete syntax of these functions see the Expression segment in the Informix Guide to SQL Syntax The LENGTH F
91. MIXDIR glfiles checks the usr informix directory for the GLS files m Change directories to the directory where you want the files that glfiles generates to reside The utility creates the GLS file listings in the current directory The following diagram shows the syntax of the gl files utility Listing GLS Locale Files The gl files utility can create a file that lists the available GLS locales in the following ways m When you specify the lc command line option m When you omit all command line options For each lcX subdirectory in the gls directory specified in INFORMIXDIR glfiles creates a file in the current directory that is called 1cX txt where X is the version number of the locale object file format The lcX txt file lists the locales in alphabetical order sorted on the name of the GLS locale object file A 22 Informix Guide to GLS Functionality Listing GLS Locale Files Figure A 2 shows a sample file 1c11 txt that contains the available GLS locales Filename lcll ar_ae 0441 1co Language Arabic Territory United Arabic Emirates Modifier greg Code Set 8859 6 Locale Name ar_ae 8859 6 Filename lcll ar_ae 0441greg lco Language Arabic Territory United Arabic Emirates Modifier greg Code Set 8859 6 Locale Name ar_ae 8859 6 Filename 1lcll en_us 0333 1co Language English Territory United States Code Set 8859 1 Locale Name en_us 8859 1 Filename lcll en_us 0333dict Lang
92. ON locale category replaces the functionality of the NLS environment variable LC_COLLATE A 6 Informix Guide to GLS Functionality u NLS Locale Categories The NUMERIC Category The NUMERIC category defines the following numeric notation for end user formats of numeric nonmonetary values m The numeric decimal separator m The numeric thousands separator m The number of digits to group between each appearance of a nonmonetary thousands separator m The characters that indicate positive and negative numbers This numeric notation applies to the end user formats of data for numeric DECIMAL INTEGER SMALLINT FLOAT SMALLFLOAT columns within a client application For more information on end user formats see page 1 12 Important Information in the NUMERIC category does not affect the internal format of the numeric data types in the database The NUMERIC category also defines alternative digits for use in era based dates and times For more information on alternative digits see Alternative Date Formats on page 2 31 and Alternative Time Formats on page 2 39 For Version 7 2 and later products the NUMERIC locale category replaces the functionality of the NLS environment variable LC_NUMERIC The MONETARY Category The MONETARY category defines the following currency notation for end user formats of monetary values m The currency symbol and whether it appears before or after a monetary value m T
93. QL C example shows a call to the rdatestr library function char str 100 long jdate rdatestr jdate str printf s n str If you set DBDATE to GY 2MD and CLIENT_LOCALE to the Japanese SJIS locale ja_jp sjis the preceding code fragment prints the following value for the date 08 18 1990 H02 08 18 Important Informix products treat any undefined characters in the alphabetic era specification as an error If you set DBDATE to a era based date format that is specific to a Chinese or Japanese locale make sure to set the CLIENT_LOCALE environment variable to a locale that supports era based dates General SQL API Features 5 9 DATE Format Functions 5 10 Extended DATE Format Strings Figure 5 3 shows the ESOL DATE format functions that support the extended DATE format strings Figure 5 3 ESQL C ESQL COBOL ESQL DATE Format Functions That Date Function Date Routine Support Extended Format Strings rdefmtdate ECO DEF rfmtdate ECO FMT Figure 5 4 shows the extended format strings that these ESOL functions support for use with GLS locales Figure 5 4 Extended Format Strings for GLS Locales Era Year Format Era Used Full era year full name of the base year eyy The era that the client locale period followed by a 2 digit year that CLIENT_LOCALE offset indicates defines Same as GL_DATE end user format of YoEC 02 2Ey Abbreviated era year abbreviated gyy The era that the client locale nam
94. QL COBOL processor processes COBOL source files The name of the ESQL COBOL processor is esqlcobol The name of the ESQL COBOL processor is esqlcob The processors for ESQL C and ESQL COBOL products use operating system files in the following situations m They write language specific source files c and cob files when they process an ESQL source file The ESQL processors use the client code set that the client locale specifies to generate the filenames for these language specific files m They read ESQL source files ec and eco that the user creates The ESQL processors use the client code set to interpret the contents of these ESQL source files You specify the client locale with the CLIENT_LOCALE environment variable For more information on this environment variable see page 2 7 Generating Non ASCII Filenames When an ESQL processor processes an ESQL source file it must generate a corresponding intermediate file for the source file If you use non ASCII characters 8 bit and multibyte character in these source file names the following restrictions affect the ability of the ESQL C or ESQL COBOL processor to generate filenames that contain non ASCII characters m The ESQL processor must know whether the operating system is 8 bit clean m The code set of the client locale the client code set must support the non ASCII characters that are used in the ESQL source filename 5 4 Informix Guide to GLS Functionality
95. QL statement that creates a table name is CREATE TABLE Restrictions apply when you use multibyte characters for table names in SE For more information see Generating Non ASCII Filenames on page 4 9 An example of an SQL statement that creates a trigger correlation name is CREATE TRIGGER An example of an SQL statement that creates a trigger name is CREATE TRIGGER An example of an SQL statement that creates a view name is CREATE VIEW 3 of 3 The SQL Segment column in Figure 3 1 on page 3 5 refers to the segment in the Informix Guide to SQL Syntax that gives the complete syntax of the identifier In many cases the complete syntax of an SQL segment can include other identifiers For example the Index Name segment in the Informix Guide to SQL Syntax shows that the syntax of an index name can include a database name a database server name and an owner name as well as the simple name of the index SQL Features 3 7 Identifiers That Support Non ASCII Characters UNIX 3 8 ry When you look up a particular object in Figure 3 1 on page 3 5 keep in mind that the simple name of the object accepts multibyte characters but the other identifiers in the syntax for that object accept multibyte characters only if they also appear in the table For example the database name identifier within the Index Name segment accepts multibyte characters but the database server name identifier within the Index Name segment does not
96. QUE TYPE statement 4 8 CREATE OPCLASS statement 4 9 CREATE PROCEDURE statement 3 7 4 9 CREATE ROLE statement 3 6 CREATE ROW TYPE statement 4 9 CREATE SYNONYM statement 3 7 CREATE TABLE statement character data types 3 12 column name in 3 5 constraint name in 3 5 MONEY columns 3 48 naming database objects 3 4 table name in 3 7 CREATE TRIGGER statement 3 7 CREATE VIEW statement 3 7 CTYPE locale category character case 5 24 description of A 4 A 6 in client locale 1 24 in default locale A 4 in locale source file A 12 in server processing locale 1 38 white space characters 2 28 2 37 Currency data See Monetary data Currency notation 1 15 1 53 2 21 Currency symbol 1 15 1 20 3 50 5 19 A 7 Cursor 1 5 1 6 1 7 1 48 3 5 4 7 5 7 cv file extension 1 42 A 15 A 20 cvo file extension A 15 A 20 cvY txt file A 25 c_ file extension 6 11 D dat file extension 4 4 Data character 3 12 converting 1 48 4 6 corruption 2 7 2 19 portability 4 12 transferring 1 34 See also Character data Date data Monetary data Numeric data Time data Data type BLOB 4 22 BYTE 1 48 4 6 Index 3 CHAR 1 48 3 18 4 6 character 3 12 CLOB 4 22 code set conversion 1 48 4 6 collation order 1 12 complex 4 23 DATE 1 15 A 9 DATETIME 1 15 A 9 DECIMAL 1 14 A 7 distinct 4 26 Dynamic Server with UD Option 4 20 FLOAT 1 14 A 7 INTEGER 1 14 A 7 internal format 1 12 locale sensitive 1 26 3 12 6 6 locale specif
97. S Version 5 0 extended format strings for era based dates October 5 1990 Description Sample Format prints as Japanese era Abbreviated era year 2 digit year yymmddj1 H021005 Abbreviated era year 4 digit year yyyymmddj1 H00021005 Full era year 2 digit year yymmddj2 A1A2021005 Full era year 4 digit year yyyymmddj2 A A200021005 Taiwanese Ming Guo date With 2 digit year yymmddcl 791005 yy mm ddc1 79 10 05 yyA A2mmA A ddA A 79ATAP10ATAZ05ALAP With 4 digit year yyyymmddcl 00791005 Figure 5 7 shows the extended format strings that these ESQL functions support for backward compatibility with ALS Version 4 x products Figure 5 7 Extended Format Strings for ALS 4 x Compatibility Era Format Format Locale Full era year full name of the base year period followed nnnnyy Japanese by a 2 digit year offset Same as GL_DATE end user format of EC 02 2Ey Abbreviated era year abbreviated name of the base year nyy Japanese period followed by a 2 digit year offset Same as GL_DATE end user format of Eg 02 2Ey Day of the week with symbols that the locale defines ww any Asian Sunday through Saturday in Asian characters Multibyte characters are printed if DB_LOCALE is set to another language General SQL API Features 5 13 DATE Format Functions 5 14 The following table shows some sample ALS Version 4 x extended format strings for era based dates October 5 1990 Description Sample Format pr
98. SQL API Features 5 25 Avoiding Partial Characters 5 26 For more information on the comparisons see Verifying the Database Locale on page 1 33 For more information on how to handle exceptions within an ESQL program see the INFORMIX ESQL C Programmer s Manual or the INFORMIX ESQL COBOL Programmer s Manual Avoiding Partial Characters When you use a locale that supports a multibyte code set make sure that you define buffers large enough to avoid the generation of partial characters Possible areas for consideration include m When you copy data from one buffer to another m When you have character data that might undergo code set conversion For more detailed examples of partial characters see Partial Characters in Column Substrings on page 3 37 Copying Character Data When you copy data you must ensure that the buffers are an adequate size to hold the data If the destination buffer is not large enough for the multibyte data in the source buffer the data might be truncated during the copy For example the following ESQL C code fragment copies the multibyte data A A A B B B from bufi to buf2 char buf1 20 buf2 5 stcopy A AZA B B2B3 buf1 stcopy bufl buf2 Because buf2 is not large enough to hold the multibyte string the copy truncates the string to A A7A B B2 To prevent this situation ensure that the multibyte string fits into a buffer before the ESQL C program performs the copy
99. SQL library functions 5 9 precedence of 1 24 1 39 1 51 5 14 sending to database server 1 32 setting 1 50 syntax 2 9 dbexport utility 1 7 2 27 4 18 dbimport utility 4 18 DBLANG environment variable precedence of 2 17 setting 1 49 syntax 2 16 dbload utility 4 18 DBMONEY environment variable defining currency symbols 5 22 ESQL library functions 5 20 5 23 precedence of 1 24 1 39 1 53 5 19 sending to database server 1 32 setting 1 53 syntax 2 20 DBNLS environment variable 1 25 1 32 1 34 1 39 1 45 1 51 1 52 1 53 dbs file extension 4 4 dbschema utility 4 18 DBTIME environment variable era based dates 3 52 ESQL library functions 5 16 precedence of 1 24 1 39 1 52 5 17 sending to database server 1 32 setting 1 50 syntax 2 22 with multibyte characters 2 24 DB_LOCALE environment variable database code set 1 41 default value 1 28 precedence of 1 37 role in code set conversion 1 45 1 47 sending to database server 1 32 server processing locale 1 37 setting 1 28 syntax 2 19 verifying database locale 1 33 See also Database locale DECIMAL data type 1 14 1 53 A 7 Decimal separator 1 14 1 19 3 50 5 19 A 7 DECLARE statement 3 5 Default locale default code set 1 19 1 20 1 30 A 13 definition of 1 18 for client application 1 28 for database server 1 28 locale modifier 1 21 locale name 1 20 required A 20 DELETE statement era based dates 3 51 GLS considerations 3 50 WHERE clause conditions 3 51 DELIMIDENT e
100. Set Conversion INFORMIX ESQL C Features Non ASCII Characters in Host Variables Locale Sensitive Character Data Types Extended ESQL C Library Functions The esqlmf Filter Filtering Non ASCII Characters Invoking the ESQL C Filter Handling Code Set Conversion Writing TEXT Values Using the DESCRIBE Statement Using the TRIM Function INFORMIX GLS Features What Is INFORMIX GLS Location of Locale Information INFORMIX GLS Features INFORMIX GLS Compatibility Informix Products Industry Conformance Managing GLS Files Glossary Index vi Informix Guide to GLS Functionality 5 17 5 23 5 24 5 24 5 25 5 25 5 26 5 26 5 27 6 4 6 5 6 7 6 7 6 8 6 12 6 13 6 14 6 17 7 3 7 4 7 5 7 5 7 6 Introduction About This Manual Types of Users Software Dependencies New Features Documentation Conventions Typographical Conventions Icon Conventions Comment Icons Feature Product and Platform Icons Compliance Icons Command Line Conventions How to Read a Command Line Diagram Sample Code Conventions Character Representation Conventions Single Byte Characters Multibyte Characters Single Byte and Multibyte Characters i in the Same String White Space in Strings Trailing White Spaces Additional Documentation On Line Manuals Printed Manuals Error Message Files Documentation Notes Release Notes Machine Kors Related Reading Compliance with In
101. TE FUNCTION 4 8 CREATE INDEX 3 4 3 6 3 21 CREATE OPAQUE TYPE 4 8 CREATE OPCLASS 4 9 CREATE PROCEDURE 3 7 4 9 CREATE ROLE 3 6 CREATE ROW TYPE 4 9 CREATE SYNONYM 3 7 CREATE TABLE See CREATE TABLE statement CREATE TRIGGER 3 7 CREATE VIEW 3 7 data manipulation 3 50 DECLARE 3 5 DELETE See DELETE statement DESCRIBE 6 14 end user formats in 1 13 FETCH 3 6 in code set conversion 1 48 4 6 INSERT See INSERT statement LOAD 3 6 3 50 3 53 PREPARE 3 6 SET EXPLAIN 1 27 UNLOAD 3 50 3 53 UPDATE See UPDATE statement SQL utilities 4 18 SQLBYTES data type constant 6 13 SQLCA structure connection warnings 1 33 5 25 SQLWARN7 flag 1 33 1 34 1 38 1 47 5 25 sqlca structure sqlerrm 1 48 4 7 sqlwarn sqlwarn7 5 25 sqlca sqlwarn sqlwarn7 flag 5 25 SQLCHAR data type constant 6 18 sqlda structure 6 12 6 14 sqlda sqlvar sqldata field 6 15 sqlda sqlvar sqllen field 6 15 sqlda sqlvar sqlname field 6 16 SQLNVCHAR data type constant 6 17 SQLTEXT data type constant 6 13 sqltypes h header file 6 13 6 18 sqlvar_struct structure description of 6 15 sqldata field 6 15 sqllen field 6 15 sqiname field 6 16 storing column data 6 15 6 16 SQLVCHAR data type constant 6 17 SQLWARN7 warning flag 1 33 1 34 1 38 1 47 5 25 Statement identifier 1 5 1 6 1 7 1 48 3 6 4 7 5 7 Stored procedure 1 5 1 6 1 7 1 48 3 7 4 7 String See Character data Quoted string Substring Substring 3 35 3 40 Synonym 3 7 systables system catalog t
102. The ESQL processor rejects any filename that contains illegal characters and displays the following error message Illegal characters in filename Using Non ASCII Characters in Source Code The ESQL processors obtain the code set for use in ESQL source files from the client locale Within an ESQL source file you can use non ASCII characters for the following objects these examples use A A and B1B to represent multibyte characters m ESQL host variable and indicator variable names For example in an ESQL C program the following use of multibyte characters is valid char AlA 20 B1B 20 EXEC SQL select coll col2 into AlA B1B2 For more information on ESQL C host variables see Non ASCII Characters in Host Variables on page 6 4 Informix Guide to GLS Functionality Enhanced ESQL Library Functions ESQL comments For example in an ESQL COBOL program the following use of multibyte characters is valid 1 2 1 2 EXEC SQL CONNECT TO A A END EXEC A A DATABASE OPENED Names of SQL identifiers such as databases tables columns views constraints prepared statements and cursors For more information see Naming Database Objects on page 3 4 Literal strings For example in an ESQL C program the following use of multibyte characters is valid EXEC SQL insert into tbll nchr1 values alag 2 Filenames and pathnames as long as your operating system supports multibyte characters in filenam
103. The following sample of output shows the result of the query Although the customer first name consists of 4 characters the length column shows that the total number of bytes in this name is 6 cust_name length cust_num aAlA bB B 6 199 The OCTET_LENGTH Function The OCTET_LENGTH function returns the number of bytes and generally includes trailing white spaces in the byte count This SQL length function uses the definition of white space that the locale defines OCTET_LENGTH returns the number of bytes in a character column quoted string host variable or procedure variable However the actual behavior of the OCTET_LENGTH function varies with the type of argument that the user specifies Informix Guide to GLS Functionality The OCTET LENGTH Function The following table shows how the OCTET_LENGTH function operates on each of the argument types The Example column in this table uses the symbol s to represent a single byte trailing white space For simplicity the Example column also assumes that the sample strings consist of single byte characters OCTET_LENGTH Argument Behavior Example Quoted string CHAR or NCHAR column VARCHAR or NVARCHAR column TEXT column Host or procedure variable Returns number of bytes in string including any trailing white spaces Returns number of bytes in string including trailing white spaces This value is the defined length in bytes of the column Returns n
104. VARCHAR a TEXT the BYTE data type is not converted Any of the ESQL C character data types char fixchar string and varchar SQL statements both static and dynamic Database objects such as Q Column names a Table names a Statement identifier names a Cursor names Stored procedure text Command text Error message text in the sqlca sqlerrm field Tip If your ESQL C client application uses code set conversion you might need to take special programming steps For more information see Handling Code Set Conversion on page 6 12 Informix Guide to GLS Functionality UNIX WIN NT Locating Message Files Locating Message Files Informix products use GLS locales to locate product specific message files By default Informix products automatically search a subdirectory that is associated with the client locale for the product specific message files Informix products search the INFORMIXDIR msg Ig_tr code_set directory Informix products search the INFORMIXDIR msg lg_ir code_set directory In this path lg and tr are the language and territory respectively from the name of the client locale and code_set is the condensed form of the code set name For more information about condensed code set names see Locale File Subdirectories on page A 10 Informix products use a precedence of environment variables to locate product specific message files The DBLANG environment variable lets you overri
105. Values Informix Guide to GLS Functionality 1 40 1 41 1 43 1 48 1 49 1 49 1 50 1 51 1 51 1 53 he Global Language Support GLS feature lets Informix products easily handle different languages cultural conventions and code sets for Asian European Latin American and Middle Eastern countries The GLS feature allows you to create databases using the diacritics collating sequence and monetary and time conventions of the language that you select No ONCOMNFIG configuration parameters exist for GLS but you must set the appropriate environment variables This chapter introduces basic concepts and describes the GLS feature It covers the following topics What a GLS locale is and what information it provides How to establish a locale for Informix products How to customize end user formats that a locale defines How a client application establishes a connection with a database How to use code set conversion to convert character data between a client and a database or a database and a file m How to use localized message files with Informix products What Is the GLS Feature In a database application most of the tasks that the database server and the client application perform do not depend on the type of data that they handle However some portion of the tasks that the database server and client application perform are dependent on the data For example the database server must sort U S English data differently than
106. When you are instructed to enter characters or to execute a command immediately press RETURN after the entry When you are instructed to type the text or to press other keys no RETURN is required Icon Conventions Icon Conventions Throughout the documentation you will find text that is identified by several different types of icons This section describes these icons Comment Icons Comment icons identify warnings important notes or tips This information is always displayed in italics Icon Description The warning icon identifies vital instructions cautions or critical information The important icon identifies significant information about the feature or operation that is being described The tip icon identifies additional details or shortcuts for the functionality that is being described QS Introduction 7 Icon Conventions 8 Icon AD XP Feature Product and Platform Icons Feature product and platform icons identify paragraphs that contain feature specific product specific or platform specific information Description Identifies information that is specific to Dynamic Server with AD and XP Options Identifies information that is specific to an Asian Language ALS Support ALS database or application E C Identifies information that is specific to the INFORMIX ESQL C product GLS Identifies information that relates to the Informix Global Lan
107. X ESQL C Features Non ASCII Characters in Host Variables Locale Sensitive Character Data Types Extended ESQL C Library Functions The esqlmf Filter Filtering Non ASCII Characters Invoking the ESQL C Filter Handling Code Set Conversion Writing TEXT Values Using the DESCRIBE Statement The sqldata Field The sqlname Field Using the TRIM Function 6 4 6 5 6 7 6 7 6 9 6 12 6 13 6 14 6 15 6 16 6 17 6 2 Informix Guide to GLS Functionality his chapter explains how the Global Language Support GLS feature affects the Informix SQL application programming interface API INFORMIX ESQL C It contains the following topics How ESQL C handles non ASCII characters in host variables How to handle the locale sensitive data types NCHAR and NVARCHAR in ESQL C applications Which ESQL C library functions support locale specific features How to use the ESQL C filter esqlmf How to handle code set conversion from within an ESOL C application How to interpret the results that the DESCRIBE statement returns for a dynamic SELECT that includes the TRIM function This chapter covers GLS information that is specific to ESQL C For GLS infor mation for INFORMIX ESQL C and INFORMIX ESOQL COBOL refer to Chapter 5 General SOL API Features Tip For descriptions of Informix SQL API features that are not unique to the GLS feature see the INFORMIX ESQL C Programmer s Manual For a discussi
108. a column assign a numeric data type such as INTEGER or FLOAT to that column The description of the CHAR data type in the Informix Guide to SQL Reference provides detailed reasons why you should not treat certain numbers as CHAR values The same reasons apply for certain numeric values as NCHAR values Treat only numbers that have leading zeros such as postal codes as NCHAR data types Use NCHAR only if you need to sort the numeric values in localized order Nonprintable Characters with NCHAR An NCHAR value can include tabs spaces and nonprintable characters Nonprintable NCHAR and CHAR values are entered displayed and treated similarly For more information on nonprintable characters see the description of the CHAR data type in the Informix Guide to SQL Reference The NVARCHAR Data Type The NVARCHAR data type stores character data in a variable length field This data can be a sequence of single byte or multibyte letters numbers and symbols However the code set of your database locale must support this character data The syntax of the NVARCHAR data type is as follows NVARCHAR max reserve In this format the max parameter specifies the maximum number of bytes that can be stored in the column and the reserve parameter specifies the minimum number of bytes that are reserved for the column You must specify the maximum size max of the NVARCHAR column The size of this parameter cannot exceed 255 bytes When you place an
109. a types in the database To customize the format of date and time values use the GL_DATE and GL_DATETIME environment variables For more information see Custom izing Date and Time End User Formats on page 1 50 For Version 7 2 and later products the TIME locale category replaces the functionality of the NLS environment variable LC_TIME The MESSAGES Category The MESSAGES category defines the format for affirmative and negative responses This category is optional Informix products do not use the strings that the MESSAGES category defines To obtain the locale name for the MESSAGES category of the client locale a client application uses the locale that CLIENT_LOCALE indicates If CLIENT_LOCALE is not set the client sets the category to the default locale Location of Locale Files When an Informix product needs to obtain locale specific information it accesses one of the following GLS locale files depending on the platform m GLS locale files reside in the following file INFORMIXDIR g1s 1cxX g_tr codemodf lco m GLS locale files reside in the following file INFORMIXDIR amp Z gls 1lcxX lg_tr codemodf lco In these paths INFORMIXDIR is the environment variable that specifies the directory in which you install the Informix product and gls is the subdi rectory that contains the GLS files Managing GLS Files A 9 Location of Locale Files A 10 This section describes the remaining elements in the pat
110. able 1 26 System catalog 1 26 2 20 T Table database in code set conversion 1 48 4 7 in SE database 4 9 naming 1 5 1 6 1 7 3 7 4 9 5 7 SE names 4 12 Taiwanese dates 1 16 1 51 2 14 Terms used in manual 1 Territory 1 20 1 33 A 10 TEXT data type code set conversion 1 48 4 6 collation order 1 12 GLS aspects 3 20 in code set conversion 6 12 partial characters 3 40 See also Binary large object blob Thousands separator 1 15 1 19 3 50 5 19 A 7 Time data customizing format of 1 50 end user format 1 15 1 19 1 39 1 50 A 9 format of A 8 locale specific 1 6 1 14 precedence of environment variables 1 52 5 17 with DBTIME 2 22 with GL_DATE 2 37 See also Data DATETIME data type TIME locale category description of A 4 A 8 end user formats 1 17 A 9 era information 2 33 2 40 A 8 in client locale 1 24 in default locale A 5 in locale source file A 12 in server processing locale 1 40 Trigger 3 7 TRIM function 3 41 6 17 U UNIX environment default code set 1 19 default locale 1 21 glfiles utility 1 21 location of message files 1 49 location of operating system locales A 11 setting environment variables 1 29 supported code set conversions 1 46 supported locales 1 21 Unload file 3 53 UNLOAD statement 3 50 3 53 UPDATE statement embedded SELECT 3 51 era based dates 3 51 GLS considerations 3 50 SET clause 3 51 WHERE clause conditions 3 51 UPPER function 3 41 User defined function 4 8
111. acter data m SQL data types Q CHAR and VARCHAR a NCHAR and NVARCHAR uD a LVARCHAR 4 6 a TEXT the BYTE data type is not converted m Any of the ESQL C character data types char fixchar string and varchar m SQL statements both static and dynamic Informix Guide to GLS Functionality AD XP Non ASCII Characters in Identifiers m Database objects such as a Column names a Table names a Statement identifier names a Cursor names For a complete list of SQL identifiers see SQL Identifiers That Support Non ASCII Characters on page 4 8 m Stored procedure text m Command text m Error message text in the sqlca sqlerrm field Tip If your ESQL C client application uses code set conversion you might need to take special programming steps For more information see Handling Code Set Conversion on page 6 12 Non ASCII Characters in Identifiers Dynamic Server with AD and XP Options permits non ASCII 8 bit and multibyte characters in many common identifiers such as column name connection name constraint name database name index name role name stored procedure name synonym table name trigger name and view name The database server does not allow multibyte characters in the following identifiers specific to Dynamic Server with AD and XP Options m Dbslice m Coserver m Cogroup Dynamic Server with AD and XP Options allows only ASCII alphanumeric 7 bit names for the following id
112. ads this value with zeros on the left m Ifthe first character is neither a minus sign nor a zero 0 an Informix product prints the field value as right justified and pads this value with spaces on the left GL_ DATETIME GL_DATETIME The GL_DATETIME environment variable specifies the end user formats of values in DATETIME columns For more information on end user formats see page 1 12 Important The GL_DATETIME environment variable supports a superset of the for matting directives of the DBTIME environment variable see page 2 22 Informix recommends that applications use GLLDATETIME instead of DBTIME A GL_DATETIME format can contain the following characters m One or more white space characters which the CTYPE category of the locale specifies For more information on the CTYPE locale category see page A 6 m An ordinary character other than the symbol or a white space character m A formatting directive which is composed of the symbol followed by a conversion character that specifies the required replacement GL_DATETIME string _______ string contains the formatting directives that specify the end user format for GL_DATETIME values You can use any formatting directive that formats dates or times For a list of formatting directives for dates see the description of GL_DATE on page 2 27 For a list of the era based formatting directives for time values see Alternative Time Formats
113. agment declares an integer host variable that contains a non ASCII character in the host variable name and then selects a serial value into this variable This code fragment declares an integer host variable hdte_ent which contains a non ASCII character in the name and selects a serial value code number in the num ro column of the abonn s table into it x7 EXEC SQL BEGIN DECLARE SECTION int h te_ent EXEC SQL END DECLARE SECTION EXEC SQL select num ro into h te_ent from abonn s where nom Otker Informix Guide to GLS Functionality Locale Sensitive Character Data Types As long as the client locale supports the non ASCII characters you can use these characters to define indicator variables as the following example shows EXEC SQL BEGIN DECLARE SECTION char h tevar 30 short ind_de_h tevar EXEC SQL END DECLARE SECTION You can then access indicator variables with these non ASCII names as the following example shows h tevar INDICATOR h tevarind h tevar h tevarind h tevar h tevarind Locale Sensitive Character Data Types The SQL data types NCHAR and NVARCHAR support locale specific data For more information about these data types see Using Character Data Types on page 3 12 ESQL C supports the predefined data types string fixchar and varchar for host variables that contain character data In addition you can use the C char data type for host variables The fo
114. ale index keys for an NCHAR column in any table of the database are stored in the localized order that the ja_jp sjis locale defines If you use the default locale U S English the index keys are stored in the code set order in ascending or descending sequence of the default code set regardless of the data type of the character column Because the default locale does not define a localized order the database server sorts NCHAR and NVARCHAR columns as well as CHAR and VARCHAR columns in code set order SQL Features 3 21 Collation Order in SELECT Statements 3 22 For a complete description of the CREATE INDEX statement see the Informix Guide to SQL Syntax Collation Order in SELECT Statements The SELECT statement performs a query on the specified table and retrieves data from the specified columns and rows Collation order affects the following parts of the SELECT statement m THE ORDER BY clause m The relational operator BETWEEN and IN conditions of the WHERE clause m The MATCHES and LIKE conditions of the WHERE clause For a complete description of the SELECT statement see the Informix Guide to SQL Syntax The ORDER BY Clause The ORDER BY clause sorts the retrieved rows by the values that are contained in a column or set of columns When this clause sorts character columns the results of the sort depend on the data type of the column as follows m CHAR and VARCHAR columns are sorted in code set order
115. alue of GLS8BITFSYS to determine whether it can use non ASCII characters in the filename of an operating system file that it generates as follows m When GLSSBITFSYS is 1 SE can use non ASCII characters in its filenames m When GLSS8BITESYS is 0 SE does not allow non ASCII characters in its filenames For example create an SE database that is called A A2B B2 where A A and B B are multibyte characters with the following SQL statement CREATE DATABASE AtA2B1B2 Tip For more information about how to use multibyte characters in the name of an SE database see Data Types for Dynamic Server with UD Option on page 4 20 If GLS8BITFSYS is 1 or is not set on the server computer SE assumes that the operating system is 8 bit clean and it generates a database directory A A B B dbs For more information on an 8 bit clean operating system and the GLS8BITFSYS environment variable see page 2 25 Data Portability Use of non ASCII characters for SE database names and table names might present compatibility problems To achieve maximum portability for SE Informix recommends that you not use non ASCII database names so that you retain the option to shift the database to an operating system that is not 8 bit clean To disable the capability of SE to generate 8 bit filenames even if the operating system is 8 bit clean set the GLS8BITFSYS environment variable to 0 4 12 Informix Guide to GLS Functionality Naming a Databas
116. anumeric 7 bit Database Server Features 4 5 Performing Code Set Conversion When the database server transfers data to and from its operating system files it handles any differences in the code sets of the server processing locale and the server locale as follows m Ifthese two code sets are the same the database server can read from or write to its operating system files in the code set of the server locale m If these two code sets are different and an Informix code set conversion exists between them the database server automatically performs code set conversion when it reads from or writes to its operating system files For code set conversion to resolve the difference in code sets the server locale must support the actual code set that the database server used to create the file For more information see The Server Code Set on page 4 10 m If these two code sets are different but no Informix code set conversion exists the database server cannot perform code set conversion If the database server reads from or writes to an operating system file for which no code set conversion exists it uses the code set of the server processing locale to perform the read or write operation Which Data Does a Client Product Convert When the code sets of two locales differ an Informix client product must use code set conversion to prevent data corruption of character data Code set conversion converts the following types of char
117. any different sources and performs a variety of data format conver sions It also supports non ASCII characters in field and record delimiters High performance loading performs the following types of operations that might involve support for non ASCII characters m Transfers data files across platforms with the Informix data format Transfers operational data from a mainframe to a data warehouse Uses the server to convert data between delimited ASCII fixed ASCII EBCDIC and Informix internal raw representation m Uses SQL INSERT and SELECT statements to specify the mapping of data to new columns in a database table Enhanced SQL statements for the loader such as CREATE EXTERNAL TABLE USING INSERT INTO SELECT and SELECT INTO EXTERNAL table name USING use identifiers that support GLS For information about these standard SQL identifiers and identifiers for Dynamic Server with AD and XP Options see Identifiers That Support Non ASCII Characters on page 3 5 For detailed information about high performance loading and unloading with external tables see your Administrator s Guide Database Server Features 4 19 Data Types for Dynamic Server with UD Option Data Types for Dynamic Server with UD Option Dynamic Server with UD Option provides support for the following data Traditional SQL 92 data types LVARCHAR data type Smart large objects Opaque data types m m m m Complex data types collections and ro
118. application database server and one or more databases might reside on different computers Figure 1 1 shows a sample database server connection between an ESQL C client application and the acctng database through an Informix database server Figure 1 1 Example of a Client Server Environment Server computer Va Log file A a Message log file Sg Client application Database server SS These computers might have different operating systems or different language support To ensure that these three parts of the database application communicate locale information successfully Informix products support the following locales The client locale identifies the locale that the client application uses The database locale identifies the locale of the data in a database m The server locale identifies the locale that the database server uses for its server specific files 1 22 Informix Guide to GLS Functionality Locales in the Client Server Environment Figure 1 2 shows the client locale database locale and server locale that the sample ESQL C application from Figure 1 1 on page 1 22 establishes Figure 1 2 The Client Locale Database Locale and Server Locale Client computer Server computer A Log file D Message log file N Client application Database server Informix Ta
119. application sets LC_MONETARY from the LANG value it does not send LANG to the database server 5 Default currency notation If DBMONEY and DBNLS are not set and no locale is specified the currency symbol is the dollar sign the thousands separator is the comma and the decimal separator is the period GLS Fundamentals 1 53 GLS Environment Variables Setting and Retrieving Environment Variables 0 23 GLS Related Environment Variables aaa 2 4 CC8BITLEVEL G se Boek Se ak See es 2 5 CLIENT_LOCALE een 2 6 IDBDATE te ae fo Alen ge ee Bose a Hos Ho aw Koeeab ack 2 8 DBEANG Ys 3 8 oe Sgn ee ot a a ek a TS DB_LOCALE 2 L a sana 2 18 DBMONEY 2 eee ee ee 219 DBEIME ok Sod oe Ae Bo Bee Bae a ERT ESOUEME e a5 aba e a SB a Se amp MS A MS A Gh 22523 GLS8BITFSYS a aaa 224 GleDATE go s ew ea Be Ok we 8 wa a a el 226 GL_DATETIME 2 2 2 36 SERVER LOCALE 2 2 42 2 2 Informix Guide to GLS Functionality UNIX WIN NT nformix products establish the client database and server locales with information from GLS related environment variables and from data that is stored in the database This chapter provides descriptions of the GLS related environment variables Setting and Retrieving Environment Variables The GLS feature lets you use the diacritics collating sequence and monetary date and numb
120. aracters for these symbols if your client code set supports them For example the following table shows how multibyte characters appear in sample output Number to Format String Format DBM ONEY Output 1234 i 1 234 00 1234 DM DM1 234 00 1234 A1A AlA 1 234 00 1234 AltA 1 234 00 Se amp amp amp amp amp amp 1234 AltA 1 234 00A1A2 amp 8 Bebe amp 8c amp 1234 AK AlA2s1 234 00 amp 8 See amp amp amp 1234 Ae 51 234 00A A2 amp be amp amp e amp amp amp 1234 AltA AtA2s1 234 00 In the preceding table the character s represents a blank or space For more information on DBMONEY see page 2 20 String Functions Figure 5 10 shows the ESQL string functions that support locale specific shifted characters Figure 5 10 ESQL C ESQL COBOL ESQL String Functions That Support String Function String Routine Locale Specific Shifted Characters rdownshift ECO DSH rupshift ECO USH General SQL API Features 5 23 GLS Specific Error Messages These string functions use the information in the CTYPE category of the client locale to determine the shifted code points For more information on the CTYPE locale category see page A 6 If the client locale specifies a multibyte code set these functions can operate on multibyte strings Important With multibyte character strings a shifted string might occupy more memory after a shift opera
121. ary however might require the following sort order for these same names Mabin Madden MacDonald McDonald If the GLS locale defines a localized order the database server sorts data in NCHAR and NVARCHAR columns in this localized order For an example of a data set in localized order see Figure 3 3 on page 3 24 GLS Fundamentals 1 11 A GLS Locale NLS ALS Collation Support The collation order that Informix database servers use depends on the data type of the database column The following table summarizes these collation orders Data Types Collation Order CHAR VARCHAR TEXT Code set order NCHAR NVARCHAR Localized order The difference in collation order is the only distinction between the CHAR and NCHAR data types and the VARCHAR and NVARCHAR data types For more information see Using Character Data Types on page 3 12 Informix Native Language Support NLS database servers before Version 7 2 use the same collation orders as Version 7 2 and later database servers code set order for CHAR and VARCHAR data and localized order for NCHAR and NVARCHAR data Informix Asian Language Support ALS database servers use code set order for CHAR and VARCHAR data They do not support NCHAR and NVARCHAR data If a locale does not define a localized order the database server collates NCHAR and NVARCHAR data in code set order End User Formats The end user format is the format in which data appears with
122. at string with the currency symbol that DBMONEY specifies if it is set or with the currency symbol that the client locale specifies if DBMONEY is not set The same is true for the decimal separator and thousands separator For example the following ESQL C code fragment shows a call to the rfmtlong function stcopy amp amp fmtbuf rfmtlong 78941 fmtbuf outbuf printf Formatted value s n outbuf In the default German and Spanish locales this code fragment produces the following results for the internal MONEY value of 78941 00 if DBMONEY is not set Format String Client Locale Formatted Value Gtr Fe Kele Default locale en_us 8859 1 78 941 00 German locale de_de 8859 1 DM 78 941 00 Spanish locale es_es 8859 1 Pts 78 941 00 Informix Guide to GLS Functionality Numeric Format Functions Currency Symbol Formatting The ESQL numeric format functions in Figure 5 9 on page 5 17 support all formatting characters that the INFORMIX ESQL C Programmer s Manual and the INFORMIX ESQL COBOL Programmer s Manual describe In addition you can use the following formatting characters to indicate the placement of a currency symbol in the formatted output Formatting Character Function This character is replaced by the precede currency symbol if the locale defines one The MONETARY category of the locale defines the precede currency symbol which is the symbol that appears before a monetary valu
123. atabase locale supports a code set that is different from but convertible to the client code set the client performs code set conversion on the data before it writes this data to the UNLOAD TO file For more information see Performing Code Set Conversion on page 1 40 SQL Features 3 53 Loading and Unloading Data The client locale and certain environment variables determine the output format of certain data types in the UNLOAD TO file These data types include DATE values MONEY values values of numeric data types and DATETIME values For further information see End User Formats on page 1 12 and How Do You Customize Client End User Formats on page 1 49 Important You can use an UNLOAD TO file which the UNLOAD statement generates as the input file the LOAD FROM file to a LOAD statement that loads another table or database When you use an UNLOAD TO file in this manner make sure that all environment variables and the client locale have the same values when you perform the LOAD as they did when you performed the UNLOAD 3 54 Informix Guide to GLS Functionality Database Server Features Using the Server Locale ee ee ee ee a ee TES Performing Code Set Conversion Ds Jada oad Are 145 What Data Does the Database Server Convert pae itt eat 4D Which Data Does a Client Product Convert 46 Non ASCII Characters in Identifiers ea wie lg AEF SQL Identifiers That Support Non ASCII Character
124. ate a database log file SE creates a file with the specified name See Naming a Database on INFORMIX SE on page 4 13 Database Server Features 4 9 Generating Non ASCII Filenames UNIX WIN NT The Message Log File The MSGPATH configuration parameter specifies a filename for a message log eRe you specify a message log that is called A1A B1B C C DID where A A B1B cic and D D are multibyte characters with the configu ration parameter in your ONCONFIG configuration file MSGPATH A A2BB2 C1c2p p2 multibyte message log filename The database server assumes that the operating system is 8 bit clean and it 1c2plp2 T42plp2 g generates a file that is called C C D D in the A A B B directory The MSGPATH configuration parameter specifies a filename for a message log Suppose you specify a message log that is called A AB B c C p D where A A2 B B2 C c2 and D D are multibyte characters with the configu ration parameter in your ONCONFIG configuration file MSGPATH A A2B B2 c c2p p2 s ff multibyte message log filename The database server assumes that the operating system is 8 bit clean and it 1c2plp2 T42plp2 g generates a file that is called C C D D in the A A B B directory The Server Code Set When the database server actually creates a file whose filename has non ASCII characters the server locale must support these non ASCII characters Before you start a database serv
125. ates an error The following table shows some era based dates Julian Year Ming Guo Year Remarks 1993 82 1993 1911 82 1912 01 1912 1911 01 1911 01 1911 1912 01 1910 02 1910 1912 02 1900 12 1900 1912 12 Important If you use a Ming Guo date string in a SELECT INSERT UPDATE or DELETE statement in a Version 7 2 or later product you might encounter a problem due to different implementations of ALS and GLS For details see the Release Notes 1 16 Informix Guide to GLS Functionality AGLS Locale Japanese Imperial era dates are tied to the reign of the Japanese emperors The following table shows Julian and Japanese era dates It shows the Japanese era format in full with abstract multibyte characters for the Japanese characters and in an abbreviated form that uses romanized characters gengo The abbreviated form of the era uses the first letter of the English name for the Japanese era For example H represents the Heisei era Julian Date Abstract Japanese Era in full Japanese Era gengo 1868 09 08 A1A7B B701 09 08 M01 09 08 1912 07 30 A A7B B745 07 30 M45 07 30 1912 07 31 A1A B B701 07 31 T01 07 31 1926 12 25 A A7B B715 12 25 T15 12 25 1926 12 26 A1A B B701 12 26 S01 12 26 1989 01 07 A1A B B764 01 07 S64 01 07 1989 01 08 A A7B B701 01 08 H01 01 08 1995 01 01 A A7B B707 01 01 H07 01 01 In the preceding table AA and B B represent multibyte Japanese characters The T
126. ature Informix database servers provide support for the following culture specific features m Processing non ASCII characters and strings You can use non ASCII characters to name user specifiable database objects such as tables columns views statements cursors and stored procedures and you can use a collation order that suits the local customs You can also use non ASCII characters in many other contexts For example you can use them to evaluate the WHERE and ORDER BY clauses of your SELECT statements or to sort data in NCHAR and NVARCHAR columns You can use GLS collation features without the modification of existing code m Evaluation of regular expressions You can use non ASCII characters in regular expression comparisons that involve NCHAR and NVARCHAR data GLS Fundamentals 1 5 GLS Support by Informix Products 1 6 m Translation of locale specific values for dates times numeric data and monetary data You can use end user formats that are particular to a country or cul ture outside the U S to specify date time numeric and monetary values when they appear in literal strings The database server can translate these formats to the appropriate internal database format m Accessibility of formerly incompatible character code sets The client application can perform code set conversion between con vertible code sets to allow you to access and share data between databases and clients that have different co
127. bles individually LENGTH function 3 42 LIKE relational operator 1 10 3 31 Literal matches 3 29 3 32 Literal string 1 12 2 5 5 7 Load file 3 53 LOAD statement 3 6 3 50 3 53 Loader support for non ASCII characters 4 19 Locale alpha class 3 9 code set See Code set COLLATION category See COLLATION locale category CTYPE category See CTYPE locale category current processing 7 4 default See Default locale definition of 1 4 1 8 1 18 environment variables 1 28 filename A 9 A 12 for code set conversion 1 40 for database server connections 1 31 identifying See Locale name International Language Supplement 1 7 listing 1 21 A 21 locale categories A 4 locale names 1 20 MESSAGES category See MESSAGES locale category MONETARY category See MONETARY locale category name See Locale name non ASCII characters 1 30 NUMERIC category See NUMERIC locale category operating system A 24 operating system compatible A 11 sample 1 31 server processing 7 4 setting 1 18 1 28 TIME category See TIME locale category uses of 1 30 US English See Default locale verifying 1 33 1 38 white space Intro 15 See also Client locale Database locale Server locale Locale category See Locale locale categories Locale environment variables 4 14 Locale file description of 1 21 A 3 listing 1 21 A 21 A 22 location of 1 21 A 9 object A 11 A 20 operating system compatible A 11 removing unused A 20 required A 20 so
128. c locale modifier is an optional locale modifier that has a maximum of four alpha numeric characters This specification modifies the cultural convention settings that the language and territory settings imply The modifier usually indicates a special type of localized order that the locale supports For example you can set modifier to specify dictionary or telephone book collation order territory is a two character name that represents the cultural conventions For example territory might specify the Swiss version of the French German or Italian language The default locale U S English has the following locale name where en indicates the English language us indicates the United States territory and code_set indicates the platform specific name of the default code set en_us code_set 1 20 Informix Guide to GLS Functionality UNIX WIN NT UNIX GLS Locale Names The name of the default locale on UNIX platforms is en_us 8859 1 The num ber 8859 1 indicates the name of the default code set the IS08859 1 code set The name of the default locale for Windows NT environments is en_us 1252 The number 1252 indicates the name of the default code set commonly known as the Microsoft ANSI code set It represents American English and most European languages Ina locale name you can specify the code set as either the code set name or the condensed form of the code set name For example the following locale names both
129. can perform operations such as the creation of databases when the client does not specify its own DB_LOCALE m Set the SERVER_LOCALE environment variable to specify a nondefault server locale If you do not set SERVER_LOCALE the server locale is the default locale U S English Informix Guide to GLS Functionality UNIX WIN NT A Nondefault Locale To set these locale environment variables assign them the name of a GLS locale see page 1 20 You set environment variables with the appropriate shell command such as setenv for the C shell For example to set the client locale to Japanese with the SJIS character set on a UNIX system you might enter the following command on the client computer at the shell prompt setenv CLIENT_LOCALE ja_jp sjis You can use the gl files utility to obtain a list of GLS locales that your Informix product supports For more information see The glfiles Utility on page A 21 You set environment variables in the registry with the SETNET22 utility or in the InetLogin structure of an SQL API program For more information on SETNET32 see your Installation Guide for Windows NT products For more information on InetLogin see the manual for your SQL API product You can examine the INFORMIXDIR gls IcX directory to determine the GLS locales that your Informix product supports For more information on this directory see Appendix A When you want to access a database locale with a n
130. ch as log files GLS Fundamentals 1 43 Performing Code Set Conversion In Figure 1 4 the black dots indicate the two points in a client server environment at which code set conversion might occur Figure 1 4 Points of GLS Code Set Conversion Client computer Server computer Logfile a Message log file N Server locale Client application Database server Informix 3 Client locale Server processing locale Database locale In the sample connection that Figure 1 4 shows the ESQL C client appli cation performs code set conversion on the data that it sends to and receives from the database server if the client and database code sets are convertible The Informix database server also performs code set conversion when it writes to a message log file if the code sets of the server locale and server processing locale are convertible NLS Informix products provide operating system locales for backward compati bility with NLS databases For information on how to list operating system locales see Appendix A Managing GLS Files 1 44 Informix Guide to GLS Functionality UNIX NLS Performing Code Set Conversion If your NLS based client application DBNLS is set uses an operating system locale for either the client or the database locale your NLS based application does not automatically perfor
131. ckward com patibility for client applications that are based on Informix Version 5 x ALS products These applications use the precedence of steps 1 3 5 and 6 in the preceding list For more information about how to run ALS based applica tions see the Informix Migration Guide Tip The precedence rules apply to how the database server determines the NUMERIC MONETARY TIME and the MESSAGES categories of the server processing locale For more information on these locale categories see page A 4 The client application passes the DBCODESET DBDATE DBMONEY DBTIME GL_DATE GL_DATETIME and LC_ environment variables if they are set to the database server It also passes the CLIENT_LOCALE and DB_LOCALE environment variables For more information see Sending the Client Locale on page 1 32 Performing Code Set Conversion Informix products use GLS locales to perform code set conversion Both an Informix client application and a database server might perform code set conversion This section provides the following information about how Informix products support code set conversion m What code set conversion is m When code set conversion is performed m Which data is converted Informix Guide to GLS Functionality Performing Code Set Conversion What Is Code Set Conversion You specify a code set as part of the GLS locale see page 1 20 At runtime Informix products adhere to the following rules to determine which code
132. column is any of the following Azevedo Llanero or Oatfield SELECT num ro nom pr nom FROM abonn s WHERE nom IN Azevedo Llanero Oatfield The query result depends on whether nom is a CHAR or NCHAR column If nom is a CHAR column the database server uses code set order see Figure 3 2 on page 3 23 The database server retrieves rows in which the value of nom is Azevedo but not rows in which the value of nom is azevedo or Azevedo because the characters A a and A are not equivalent in the code set order see Figure 3 2 on page 3 23 The query also returns rows with the nom values of Llanero and Oatfield Informix Guide to GLS Functionality Collation Order in SELECT Statements However if nom is an NCHAR column the database server uses localized order see Figure 3 3 on page 3 24 to sort the rows If the locale defines A a and A as equivalent characters in the localized order the query returns rows in which the value of nom is Azevedo azevedo or Azevedo The same selection rule applies to the other names in the parenthetical list that follows the IN keyword Comparisons with MATCHES and LIKE Conditions Collation rules also affect the WHERE clause when the expressions in the condition are column expressions with character data types and the search condition is one of the following conditions m MATCHES condition m LIKE condition MATCHES Condition A MATCHES condition tests for matching character str
133. compatibility with Informix ALS products Informix recommends that you use the GL_DATE environment variable see page 2 27 for date end user formats in new client applications For a description of the standard DBDATE formats and general information about this environment variable refer to the Informix Guide to SQL Reference This section describes the era based Asian formats that DBDATE supports For more information on era based dates see Era Based Date and Time Formats on page 1 51 GLS Environment Variables 2 9 DBDATE Era Based DBDATE Formats The DBDATE environment variable supports special extensions that format values in DATE columns as era based date strings The following diagram shows the syntax of the era based date DBDATE formats Era Based DBDATE Formats ALS 6 0 Era Based Format p 2 11 ALS 5 0 Era Based Format p 2 13 ALS 4 0 Era Based Format p 2 14 For DBDATE to format era based dates you must have a client locale that supports eras The CLIENT_LOCALE environment variable must specify the name of a locale that defines era information If the client locale does not support eras Informix products ignore these era based formats Tip Era based date formats can also appear in the date format strings of certain ESQL library functions For more information see Extended DATE Format Strings on page 5 10 2 10 Informix Guide to GLS Functionality DBDATE ALS ALS 6 0 E
134. contains the string Ludwigssss the result is still 6 If the cat_descr column in the catalog table is a TEXT column and this column contains the string Ludwig the result is 6 If the cat_descr column contains the string Ludwigssss the result is 10 If the procedure variable f_name is defined as CHAR 15 and this variable contains the string Ludwig the result is 6 If the f_name variable contains the string Ludwigssss the result is still 6 The LENGTH Function With Single Byte Code Sets When you use the default locale or any locale with a single byte code set the LENGTH function seems to return the number of characters in the column In the following example the stores7 database which contains the customer table uses the default code set for the U S English locale Suppose a user enters a SELECT statement with the LENGTH function to display the last name length of the last name and customer number for rows where the customer number is less than 106 SELECT Iname AS cust_name length fname AS length customer_num AS cust_num FROM customer WHERE customer_num lt 106 The following sample of output shows the result of the query For each row that is retrieved the length column seems to show the number of characters in the Iname cust_name column However the length column actually displays the number of bytes in the Iname column In the default code set 1 byte stores 1 character For more information abo
135. cription Identifies information that is specific to an ANSI compliant database Identifies information that is an Informix extension to ANSI SQL 92 entry level standard SQL I XO Identifies functionality that conforms to X Open These icons can apply to a row in a table one or more paragraphs or an entire section If an icon appears next to a section heading the compliance infor mation ends at the next heading at the same or higher level A symbol indicates the end of compliance information that appears in a table row or a set of paragraphs within a section Introduction 9 Command Line Conventions Command Line Conventions This section defines and illustrates the format of commands that are available in Informix products These commands have their own conventions which might include alternative forms of a command required and optional parts of the command and so forth Each diagram displays the sequences of required and optional elements that are valid in a command A diagram begins at the upper left corner with a command It ends at the upper right corner with a vertical line Between these points you can trace any path that does not stop or back up Each path describes a valid form of the command You must supply a value for words that are in italics You might encounter one or more of the following elements on a command line path Element Description command This required element is usually the product
136. ct oriented relational database with the creation of new data types For information about how these new data types might affect global language support see Chapter 4 Database Server Features e SQL Features 3 3 Naming Database Objects Naming Database Objects You need to assign names to database objects when you use data definition statements such as CREATE TABLE and CREATE INDEX This section describes considerations for naming database objects when you use a nondefault locale In particular this section explains which SQL identifiers and delimited identifiers accept non ASCII characters Important To use a nondefault locale you must set the appropriate locale environment variables for Informix products For more information see A Nondefault Locale on page 1 28 Rules for Identifier Names An SQL identifier is a sequence of letters digits and underscores that repre sents the name of a database object such as a table column index or view The following table summarizes the rules for SQL identifiers SQL Identifier Rules For More Information An SQL identifier must begin with a letter or with an Valid Characters in underscore The remaining characters in the identifier Identifier Names on can be any combination of letters numbers and page 3 9 underscores You cannot include white space characters in identifiers _ Non ASCII Characters unless you use them in a delimited identifier You in Delimited
137. cter Set Identifier CCSID 437 a common IBM UNIX code set the code is hexadecimal 0x83 If the code for 4 on the client is sent unchanged to the IBM UNIX computer it prints as the Greek character y gamma This action occurs because the code for y is hexadecimal 0xE2 on the IBM UNIX computer m One language can have several code sets Each might represent a subset of the language For example the code sets ccdc and big5 are both internal represen tations of a subset of the Chinese language However these subsets consist of different numbers of Chinese characters Tip The IBM CCSID code set numbers are a system of 16 bit numbers that uniquely identify the coded graphic character representations Informix products support the CCSID numbering system For more information see Appendix A Managing GLS Files If a code set conversion is required when data goes from computer A to computer B it is also required when the data goes from computer B to computer A In the client server environment the following situations might require code set conversion m Ifthe client locale and database locale specify different code sets the client application performs code set conversion so that the server computer is not loaded with this type of processing m If the server locale and server processing locale specify different code sets the database server performs code set conversion when it writes to and reads from operating system files su
138. cter information The database server uses the value of the DB_LLOCALE environment variable that the client application sends However if you do not set DB_LOCALE on the client computer the database server uses the value of DB_LOCALE on the server computer as the database locale For client applications if you do not set DB_LOCALE on the client computer the client applications assume that the database locale is the value of the CLIENT_LOCALE environment variable However the client application does not send this assumed value to the database server when it requests a connection DBM ONEY The DBMONEY environment variable specifies the end user formats for values in MONEY columns For more information about end user formats see page 1 12 a J C e front Tip For a detailed description of the syntax for DBMONEY see the Informix Guide to SQL Reference 2 20 Informix Guide to GLS Functionality DBMONEY With this environment variable you can set the following currency notation m The currency symbol that appears before or after the monetary value The front value specifies a currency symbol before the monetary value and the back value specifies a currency symbol after the value The currency symbol can be non ASCII characters if your client locale supports a code set that defines the non ASCII characters that you use m The monetary decimal separator which separates the integral part of th
139. cter is neither a minus sign nor a zero 0 the Informix product assumes that the field value is right justified and any spaces on the left are pad characters However if the field value begins with a zero it cannot include pad characters An Informix product ignores the field specification if the field value is not a numeric value 2 34 Informix Guide to GLS Functionality GL_DATE Field Specification for a Print When an Informix product uses an end user format to print a date string the field specification defines the number of characters to print as output This field specification has the following syntax precision Formatting Directives C d e Ey iy iY Yom Ww y Y a A b B EC Eg h width is a decimal number thatindicates a minimum field width for the printed value precision is a decimal number that indicates the precision to use for the field value The meaning of the precision value depends on the particular formatting directive with which it is used as the following table shows Description Value of precision specifies the minimum number of digits to print If a value supplies fewer digits than precision specifies an Informix product pads the value with leading zeros The d Ey iy m w and y formatting directives have a default precision of 2 The Y directive has no precision default year 0001 would be formatted as 1 rather than as 0001 Value of precisi
140. cter strings that begin with ASCII characters before characters strings that begin with non ASCII characters in the sorted results 1 10 Informix Guide to GLS Functionality A GLS Locale For an example of a data set in code set order see Figure 3 2 on page 3 23 Localized Order Localized order refers to an order of the characters that relates to a real language The locale defines the order of the characters in the localized order For example even though the character might have a code point of 133 the localized order could list this character after A and before B A 65 A 133 B 66 In this case the string B sorts after AC but before BD Tip The COLLATION category of the locale file determines the localized order For more information on the COLLATION category see page A 6 The localized order can include equivalent characters those characters that the database server is to consider as equivalent when it collates them For example if the locale defines uppercase and lowercase versions of a character as equivalent characters in the localized order the database server considers the strings Arizona ARIZONA and arizona as equivalent and collates them together A localized order can also specify a certain type of collation order It can define a telephone book sorting order or a dictionary sort order For example a telephone book might require the following sort order Mabin McDonald MacDonald Madden A diction
141. data type stores text such as PostScript or HTML files You can seek smart large objects in bytes but not in characters Therefore you need to manage the byte offset of multibyte characters when you seek infor mation in smart large objects You can use the functions of INFORMIX GLS to assist you in this task For more information see Chapter 7 INFORMIX GLS Features Dynamic Server with UD Option does not automatically perform code set conversion for either of these smart large object data types Informix Guide to GLS Functionality Complex Data Types Complex Data Types Dynamic Server with UD Option also provides support for the complex data types m Collection types SET MULTISET and LIST m Row types named row types and unnamed row types Any of these data types can have members with character date or time or numeric data types The database server can still handle the GLS concerns for these data types when they are part of a complex data type Opaque Data Types Dynamic Server with UD Option provides the capabilities for programmers to define opaque data types An opaque data type is fully encapsulated its internal structure is not known to the database server Therefore the database server cannot automatically perform locale specific tasks such as code set conversion for opaque types When you create an opaque data type you must write the support functions and SQL functions of the opaque type so that they
142. database server compatibility issues 4 12 data file 4 4 data portability 4 12 index file 4 4 log file 4 4 multibyte characters 4 12 multibyte filenames 2 27 naming a database 4 13 NCHAR sizing restrictions 3 12 non ASCII filenames 2 27 operating system files 4 4 using GLS8BITFSYS 2 27 4 12 See also Database server INITCAP function 3 41 INSERT statement embedded SELECT 3 51 end user formats 1 13 era based dates 3 51 GLS considerations 3 50 specifying quoted strings 3 34 VALUES clause 3 51 INTEGER data type 1 14 A 7 1SO8859 1 code set 1 19 1 21 J Japanese Imperial dates 1 16 1 17 1 51 2 14 2 15 Japanese locale 1 7 1 29 1 31 1 34 1 38 1 47 K Korean locale 1 7 1 31 L LANG environment variable precedence of 1 25 1 39 1 52 1 53 2 18 sending to database server 1 32 Language code sets 1 43 default 1 20 for client application 1 23 for database 1 26 for database server 1 27 in locale name 1 20 1 33 A 10 lc file extension A 11 A 12 A 15 A 20 lco file extension A 11 A 20 IcX txt file A 22 A 24 LC_COLLATE environment variable 1 25 LC_COLLATION environment variable 1 37 LC_CTYPE environment variable 1 25 1 37 LC_MONETARY environment variable 1 25 1 39 1 53 LC_NUMERIC environment variable 1 25 1 39 LC_TIME environment variable 1 25 1 39 1 51 precedence 1 52 LC_ environment variables See the LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME environment varia
143. date and times of the DBTIME environment variable m Extensions to the date and time format strings for ESQL DATETIME format functions m Support for a precedence of DATETIME end user formats Figure 5 8 ESQL C ESQL COBOL ESQL DATETIME Format Functions DATETIME Function DATETIME Routine That Support Era Based Extensions dtcvfmtasc ECO DTCVASC dttofmtasc ECO DTTOASC This section describes locale specific behavior of the ESQL DATETIME format functions For general information on the syntax and use of the ESQL C DATETIME format functions see the INFORMIX ESQL C Programmer s Manual For general information on the syntax and use of ESQL COBOL DATETIME format routines see the INFORMIX ESQL COBOL Programmer s Manual GL_DATETIME Support The value of the GL_DATETIME environment variables can affect the results that these ESOL DATETIME format functions generate The end user format that GL_DATETIME specifies overrides date and time formats that the client locale defines For more information see Precedence for DATETIME End User Formats on page 5 17 General SQL API Features 5 15 DATETIME Format Functions Format y Yom dc1 Y m Yodel y Yom dj1 Y m dj1 y m dj2 Y Yom dj2 DBTIME Support The ESQL DATETIME format functions in Figure 5 8 on page 5 15 support the extended era based date and time format strings for the DBTIME environment variable For more information on the era based date and time ext
144. date format qualifier defines a field specification for the date that the Informix product scans or prints The following sections describe what a field specification means for the scan and print operations For more information on the scan and print operations see End User Formats on page 1 12 Tip The GL_DATETIME environment variable accepts these date format qualifiers in addition to those that Optional Time Format Qualifiers on page 2 40 lists GLS Environment Variables 2 33 GL_DATE Field Specification for a Scan When an Informix product uses an end user format to scan a date string the field specification defines the number of characters to expect as input This field specification has the following syntax max_width min_width max_width is a decimal number that indicates the maximum number of characters to scan min_width isa decimal number that indicates the minimum number of char acters to scan The first character of the field specification indicates whether to assume that the field value is justified or padded as follows m If the first character is a minus sign an Informix product assumes that the field value is left justified and begins with a digit this value can include trailing spaces m If the first character is a zero 0 an Informix product assumes that the field value is right justified and any zeros on the left are pad characters they are not significant m If the first chara
145. de sets For more infor mation on code set conversion see page 1 40 Tip For more information on how the database server provides support for the GLS feature refer to Chapter 4 Database Server Features Informix Client Applications and Utilities To the GLS feature a client application can be either an Informix SQL API prod uct such as INFORMIX ESOL C or INFORMIX ESOL COBOL or an Informix database server utility such as DB Access dbexport or onmode The follow ing Informix client applications provide support for the GLS feature m The DB Access utility which is bundled with Informix database servers allows user specifiable database objects such as tables columns views statements cursors and stored procedures to include non ASCII characters and to be sorted according to localized collation rules For more information on identifiers see Identifiers That Support Non ASCII Characters on page 3 5 For additional SQL identifiers see SQL Identifiers That Support Non ASCII Characters on page 4 8 For more general information about the DB Access utility refer to the DB Access User Manual Informix Guide to GLS Functionality GLS Support by Informix Products m The SQL APIs allow host and indicator variable names as well as names of user specifiable database objects such as tables columns views statements cursors and stored procedures to include non ASCII characters For more information see Cha
146. de the client locale as the location of message files that Informix products use You might use DBLANG to specify a directory where the message files reside for each locale that your environment supports For more information see the entry for DBLANG in Chapter 2 GLS Environment Variables How Do You Customize Client End User Formats You can set environment variables to override the following end user formats in the client locale m End user format of date and time DATE DATETIME values m End user format of monetary MONEY values This section explains how to customize these end user formats For a description of an end user format see page 1 12 GLS Fundamentals 1 49 Customizing Date and Time End User Formats Customizing Date and Time End User Formats The GLS locales define end user formats for dates and times which you do not usually need to change However you can customize end user formats for DATE and DATETIME values for example 10 27 97 for the date 10 27 97 with the following environment variables Environment Variable Description GL_DATE Supports extended format strings for international formats in date end user formats GL_DATETIME Supports extended format strings for international formats in time end user formats DBDATE Specifies a date end user format Supported for backward compatibility DBTIME Specifies a time end user format for certain embedded language ESQL library functions Suppor
147. dustry Standards Informix Welcomes Your Comments OOMONNDGT A A RAO 2 Informix Guide to GLS Functionality ead this introduction for an overview of the information provided in this manual and for an understanding of the documentation conventions used About This Manual This manual describes the Global Language Support GLS feature available in Informix products The GLS feature allows Informix application programming interfaces APIs and Informix database servers to handle different languages cultural conventions and code sets This manual describes only the language related topics that are unique to GLS The GLS feature provides support for the following language related topics Collation order of characters Definition of uppercase and lowercase conventions Non ASCII characters as character data Culture specific formatting for numeric monetary date and time values This manual is platform independent It provides GLS information for both Microsoft Windows NT and UNIX platforms for the following Informix database servers Informix Dynamic Server Informix Dynamic Server Developer Edition Informix Dynamic Server Workgroup Edition Informix Dynamic Server with Advanced Decision Support and Extended Parallel Options Introduction 3 Types of Users m Informix Dynamic Server with Universal Data Option m INFORMIX SE Types of Users This manual is written for application developers and system ad
148. e m The INFORMIX SE database server uses GLS8BITFSYS on the server computer to create files for database and table names For a list of these SE files see Using the Server Locale on page 4 3 m Some database utilities such as dbexport use GLS8BITFSYS on the client computer to create files m The compilers for INFORMIX ESQL C and INFORMIX ESQL COBOL products use GLS8BITFSYS on the client computer to create and use ESQL source files For a list of these files see Non ASCII Characters in ESOL Source Files on page 5 4 Once an Informix product has generated an operating system file it has written that filename and the file contents in a particular code set Whenever an Informix product or client application needs to access that file you must ensure that the product uses a server processing locale that supports that same code set For more information refer to the section for your Informix product that the preceding list names GL_DATE The GL_DATE environment variable specifies end user formats of values for DATE columns For more information on end user formats see page 1 12 Important GL_DATE is evaluated when it is used If it is invalid the operations that called it fail The extended functionality of the GLLDATE environment variable replaces the func tionality of the DBDATE environment variable see page 2 9 Informix recommends that applications use GL_DATE instead of DBDATE GLS Environment Variables
149. e When you group several dollar signs in a row a single currency symbol floats to the rightmost position that it can occupy without interfering with the number This character is replaced by the succeed currency symbol if the locale defines one The MONETARY category of the locale defines the succeed currency symbol which is the symbol that appears after a monetary value For more information see The MONETARY Category on page A 7 You can include both formatting characters in a format string The locale defines whether the currency symbol appears before or after the monetary value as follows m If the locale formats monetary values with a currency symbol before the value the locale sets the currency symbol to the precede currency symbol and sets the succeed currency symbol to a blank character m If the locale formats monetary values with a currency symbol after the value the locale sets the currency symbol to the succeed currency symbol and sets the precede currency symbol to a blank character General SQL API Features 5 21 Numeric Format Functions 5 22 The default locale defines the currency symbol as the precede currency symbol which appears as a dollar sign In the default locale the succeed currency symbol appears as a blank In the default German and French locales the numeric format functions produce the following results for the internal MONEY value of 1 00 Format String Client
150. e Set Target Code Set Code Set Conversion Source File 1SO8859 1 Microsoft 1252 033304e4 cvo Microsoft 1252 1SO8859 1 04e40333 cvo 1SO8859 1 IBM CCSID 850 03330352 cvo IBM CCSID 850 1SO8859 1 03520333 cvo Microsoft 1252 IBM CCSID 850 04e40352 cvo IBM CCSID 850 Microsoft 1252 035204e4 cvo Figure A 4 on page A 25 shows the output that the glfiles utility generates for these code set conversion files Tip To save disk space you might want to keep only those code set conversion files that you intend to use For information about which code set conversion files you can remove refer to Removing Locale and Code Set Conversion Files on page A 20 Code Set Files An Informix code set file also called a character mapping or charmap file defines a code set for subsequent use by locale and code set conversion files A GLS locale includes the appropriate code set file for the code set that it supports In addition Informix products can perform code set conversion between the code sets that have code set files Managing GLS Files A 17 The Informix registry File UNIX WIN NT WIN NT When an Informix product needs to obtain code set information it accesses one of the following GLS code set files depending on the platform m GLScode set files reside in the following file INFORMIXDIR gls cmZ code cmo m GLScode set files reside in the following file INFORMIXDIR gls cmZ code cmo In these paths INFORMIXDIR is the en
151. e X Open XPG4 internationalization standards 7 6 Informix Guide to GLS Functionality UNIX Managing GLS Files This appendix provides the following information about how to manage GLS files How GLS files provide locale related information What information a GLS locale file provides What other GLS files Informix products use How to determine which GLS files you can remove if you do not need them m How to list the available GLS locales and code set conversions with the glfiles utility Accessing GLS Files Informix products access the following GLS files to obtain locale related information GLS Files Reference GLS locale files page A 3 Code set conversion files page A 14 Code set files page A 17 The registry file page A 18 Accessing GLS Files A 2 Locale Specific Information Collation order Exact localized order Exact code set collation order Character mappings Locale specific mapping between uppercase and lowercase characters Locale specific classification GLS File to Examine Source locale file 1c LC_COLLATION category Source code set file cm Source locale file 1c LC_CTYPE category Source locale file 1c In general you do not need to examine the GLS files However you might want to look at these files to determine the following locale specific information Reference Figure A 1 on page A 12 page A 17 Figure A 1 on page A 12 Figure A 1
152. e following SELECT statement attempts to collate the query results according to the portion of the multi_chars column that is contained in the fourth to sixth characters of the column SELECT FROM multi_data ORDER BY multi_chars 7 12 If the locale supports a multibyte code set whose characters are all 2 bytes in length you know that the fourth character in the column begins in byte position 7 and the sixth character in the column ends in byte position 12 The preceding SELECT statement does not generate partial characters SQL Features 3 39 Specifying Column Substrings dk However if your multibyte code set contains a mixture of single byte characters 2 byte characters and 3 byte characters the column substring multi_chars 7 12 might create partial characters from the multi_chars data In this case you might get unexpected results when you specify a column substring in the ORDER BY clause For information on the collation order of different types of character data in the ORDER BY clause see The ORDER BY Clause on page 3 22 For the complete syntax and usage of the ORDER BY clause see the SELECT statement in the Informix Guide to SQL Syntax Tip A partial character might also be generated when an ESQL program copies multibyte data from one buffer to another For more information see Avoiding Partial Characters on page 5 26 Avoidance in BYTE and TEXT Columns Partial characters are not a problem when you
153. e for DATETIME End User Formats The ESQL DATETIME format functions use the following precedence to determine the end user format of values in DATETIME columns 1 The end user format that DBTIME specifies if DBTIME is set 2 The end user format that GL_DATETIME specifies if GLLDATETIME is set 3 The date and time end user formats that the client locale specifies if CLIENT_LOCALE is set 4 The date and time end user format from the default locale iY m d H M S For more information on the precedence of DBDATE GL_DATE and CLIENT_LOCALE refer to Customizing Date and Time End User Formats on page 1 50 Numeric Format Functions The ESQL numeric format functions in Figure 5 9 support the following extensions to format numeric values m Support for multibyte characters in format strings m Locale specific formats for numeric values m Formatting characters for currency symbols m Support for the DBMONEY environment variable Figure 5 9 ESQUC ESQL COBOL ESQL Numeric Format Functions That Numeric Function Numeric Routine Support Extended Numeric Formats rfmtdec None rfmtdouble ECO FEL rfmtlong ECO FIN General SQL API Features 5 17 Numeric Format Functions 5 18 This section describes locale specific behavior of the ESQL numeric format functions For general information on the syntax and use of the ESQL C numeric format functions see the INFORMIX ESQL C Programmer s Manual For general information
154. e is a locale sensitive data type The only difference between NVARCHAR and VARCHAR data types is the collation order The database server collates data in NVARCHAR columns in localized order The database server collates data in VARCHAR columns in code set order For more information on collation order see The Collation Order on page 1 10 Tip The default locale U S English does not specify a localized order Therefore the database server sorts NVARCHAR data in code set order When you use the default locale there is no difference between VARCHAR and NVARCHAR data SQL Features 3 15 The NVARCHAR Data Type 3 16 Handling NVARCHAR Data Within a client application always manipulate NVARCHAR data in the CLIENT_LOCALE of the client application The client application performs code set conversion of NVARCHAR data automatically if CLIENT_LOCALE differs from DB_LOCALE For information on code set conversion see page 1 40 Multibyte Characters with NVARCHAR To store multibyte character data in an NVARCHAR column your database locale must support a code set with these same multibyte characters When you store multibyte characters make sure to calculate the number of bytes that are needed The max parameter of the NVARCHAR data type refers to the maximum number of bytes that the column can store Because one multibyte character might use several bytes for storage the value of max bytes does not indicate the number of charact
155. e monetary value from the fractional part You can specify a comma or a period as the monetary decimal separator When you use one of these symbols in the DBMONEY value you implicitly assign the other symbol to the thousands separator For example suppose you set DBMONEY as follows DM This value sets the following currency notation m The currency symbol DM appears before a monetary value m The decimal separator is a comma m The thousands separator is a period In the default locale the currency symbol is the dollar sign and it appears at the front of the monetary values The period is the decimal separator and the comma is the thousands separator The currency notation that you specify with DBMONEY takes precedence over the currency notation that the locale defines For more information see Customizing Monetary Values on page 1 53 GLS Environment Variables 2 21 DBTIME DBTIME The DBTIME environment variable specifies the end user formats of values in DATETIME columns for SQL API routines For more information on end user formats see page 1 12 Tip The DBTIME environment variable affects only certain DATETIME and INTERVAL formatting routines in the INFORMIX ESQL COBOL and INFORMIX ESQL C function libraries For information about how these library functions are affected refer to DATETIME Format Functions on page 5 15 Standard DBTIME Formats see SQLR DBTIME
156. e of the base year period followed that CLIENT_LOCALE by a 2 digit year offset indicates defines Same as GL_DATE end user format of Eg 02 2Ey The extended format strings in Figure 5 4 format eras with 2 digit year offsets To obtain a 4 digit year offset use the c1 j1 or j2 extended format strings see Figure 5 6 on page 5 12 Informix Guide to GLS Functionality DATE Format Functions Figure 5 5 shows some sample extended format strings for era based dates Description Figure 5 5 Sample Extended Format Strings for GLS Locales Sample Format October 5 1990 prints as Abbreviated era year Full era year gyymmdd gyy mm dd eyymmdd eyy mm dd eyyB B mmB BddB B HO21005 HO2 10 05 A1A2021005 AlA202 10 05 A1A202B B210B B205B B2 The examples in Figure 5 5 assume that the client locale is Japanese SJIS ja_jp sjis The following ESQL C code fragment contains a call to the rdefmtdate library function char fmt_str 100 char in_str 100 long jdate stcopy eyymmdd rdefmtdate amp jdate fmt_str in_str Era Year 4s n in_str printf Full rdatestr 10 05 95 stcopy gyy mm dd rdefmtdate amp jdate fmt_str in_str printf Abbreviated Era Year amp jdate fmt_str fmt_str s n in_str When the CLIENT_LOCALE specifies the Japanese SJIS ja_jp sjis locale the code fragment displays the following output Abbreviated Era Year H07 10 05
157. e on INFORMIX SE Naming a Database on INFORMIX SE The INFORMIX SE database server limits the name of a database to 10 bytes When you use multibyte characters in database names you must ensure that the database name meets this size requirement The following CREATE DATABASE statement creates a database name of five multibyte characters CREATE DATABASE A A2B1B2C c2p p2E1E2 The database name that is shown in the preceding representation is 10 bytes long five 2 byte multibyte characters so it does not exceed the maximum length for SE database names However the following CREATE DATABASE statement generates an error because the total number of bytes in this database name is 12 CREATE DATABASE A1A2A3A4B1B2B3B4C C2C3C4 This statement specifies three 4 byte characters for the name of an SE database In this case the total number of bytes in the database name would be 12 bytes and this length exceeds the maximum length for a database name in SE The database server rejects the statement with the following error message 354 Incorrect database or cursor name format To recover from this error you must reenter the CREATE DATABASE statement and specify a name whose total length in the buffer is not more than 10 bytes Tip You specify the database name in the code set of the client locale the client code set When your client application performs code set conversion on a database name it might expand this name beyond the 10 charact
158. e set if it exists only in the source code set For example if the character 4 is passed to a target computer whose code set does not contain that character the target computer can never process or print the character exactly GLS Fundamentals 1 41 Performing Code Set Conversion For each character in the source code set a corresponding character in the target code set should exist However if the source code set contains characters that are not in the target code set the conversion must then define how to map these mismatched characters to the target code set Absence of a mapping between a character in the source and target code sets is often called a lossy error If all characters in the source code set exist in the target code set mismatch handling does not apply A code set conversion uses one of the following four methods to handle mismatched characters m Round trip conversion This method maps each mismatched character to a unique character in the target code set so that the return mapping maps the original character back to itself This method guarantees that a two way conversion results in no loss of information however data that is converted just one way might prevent correct processing or printing on the target computer m Substitution conversion This method maps all mismatched characters to one character in the target code set that highlights mismatched characters This method guarantees that a one way conversio
159. e value of the CC8BITLEVEL environment variable determines the type of processing that the ESQL C filter esqlmf performs on non ASCII characters The following values are possible 0 tells the esqlmf filter to convert all non ASCII characters in literal strings and comments to octal constants for C compilers that do not support these uses of non ASCII characters 1 tells the esqlmf filter to convert non ASCII characters in literal strings to octal constants but allow them in comments some C compilers do support non ASCII characters in comments 2 tells the esqlmf filter to allow non ASCII characters in literal strings and ensure that all the bytes in the non ASCII characters have the eighth bit set for C compilers with this requirement 3 indicates that the esqlmf filter does not need to filter non ASCII characters for C compilers that support multibyte characters in literal strings and comments GLS Environment Variables 2 5 CC8BITLEVEL To invoke esqlmf each time that you process an ESQL C file with the esql command set the ESQLMF environment variable to 1 see page 2 24 If you do not set CC8BITLEVEL the esq command assumes a value for CC8BITLEVEL of 0 Important For ESQLMF to take effect do not set CC8BITLEVEL to 3 For more information on the actions that esqlmf takes see The esqlmf Filter on page 6 7 2 6 Informix Guide to GLS Functionality CLIENT_LOCALE CLIENT_LOCALE The CLIENT_LOCALE envi
160. e_set are the language territory and code set respectively in locale_name The value of DBLANG does not affect the messages that the database server writes to its message log The database server obtains the locale for these messages from the SERVER_LOCALE environment variable GLS Environment Variables 2 17 DBLANG NLS ALS ALS If DBLANG is not set the msg subdirectory for the locale in INFORMIXDIR msg I _tr code_set on UNIX systems or INFORMIXDIR msg l _tr code_set in Windows NT environ ments where lg and tr are the language and territory respectively from the locale that is associated with the Informix product and code_set is the condensed name of the code set that the locale supports a For Informix client products lg and tr are from the client locale from CLIENT_LOCALE if it is set a For Informix database server products lg and tr are from the server locale from SERVER_LOCALE if it is set If LANG and DBNLS are set the client uses NLS but DBLANG is not set a In INFORMIXDIR msg LANG on UNIX or INFORMIXDIR msg LANG on Windows NT b In INFORMIXDIR LANG on UNIX or INFORMIXDIR LANG on Windows NT If DBLANG CLIENT_LOCALE and LANG are not set a In INFORMIXDIR msg en_us 0333 on UNIX systems or INFORMIXDIR msg en_us 0333 in Windows NT environ ments an internal message directory for the default locale b In INFORMIXDIR msg en_us 8859 1 on UNIX systems or INFORMIXDIR
161. either the full or the abbreviated era name during a scan during a print EC is replaced by the full name of the base year of the era that the locale defines same as C if the locale does not define an era accepts either the full or the abbreviated era name during a scan during a print Eg is replaced by the abbreviated name of the base year of the era that the locale defines same as C if the locale does not define an era is replaced by the offset from the start of the era that EC or Eg specifies This date is the era year only same as y if the locale does not define an era Because DATETIME values must be compliant with ANSI SQL standards you cannot specify a literal DATETIME string that does not comply with these standards in an SQL statement GLS Environment Variables 2 23 ESQLMF The following examples show valid DATETIME input values for the given DBTIME formats DBTIME Format December 27 1991 appears as b Yd Y Dec 27 1991 y Yom dc1 80 12 27 Y Ym dc1 0080 12 27 WEg Ey Yom d H M S H03 12 27 22 12 10 You can include non ASCII characters in an era based DBTIME format if the client locale supports a code set that contains these characters For example suppose you set CLIENT_LOCALE to the Japanese SJIS locale ja_jp sjis To specify the multibyte SJIS character AA as the separator between hours minutes and seconds you might set DBTIME to the following string GECREy m d SHALACRMATAZRSAL
162. eives the data from the client appli cation the database server uses the end user format to interpret this literal date so that it can convert it to the appropriate internal format 35142 When an Informix product prints a string it uses an end user format to determine how to format the numeric value as a string For example suppose that an ESQL C client application has a French locale as its client locale and this locale defines a date end user format that formats dates as dd mm yy The following rdatestr function uses the end user format for dates to obtain the value in the datestr character variable err rdatestr jdate datestr The rdatestr function uses the end user format to determine how to format the internal format 35142 as a date string before it puts the value in the datestr variable For more information about the effect of the GLS feature on SQL API library functions see Enhanced ESQL Library Functions on page 5 7 GLS Fundamentals 1 13 A GLS Locale A GLS locale defines end user formats for the following types of data m Representation of currency notation and numeric format You can use an end user format that is particular to a country or cul ture outside the U S to specify monetary values m Representation of dates and times You can specify date and time values in an end user format that is particular to a country or culture outside the U S The following sections describe each of these
163. ensions see the description of DBTIME on page 2 22 When you set DBTIME to one of the era based formats these functions can use era based dates and times to convert between literal DATETIME strings and internal DATETIME values Tip Informix products support DBTIME for backward compatibility with earlier products Informix recommends the use of the GLLDATETIME environment variable for new applications If you set DBTIME to a era based DATETIME format that is specific to a Chinese or Japanese locale make sure to set the CLIENT_LOCALE environment variable to a locale that supports era based dates and times Extended DATETIME Format Strings The following table shows the extended format strings that the ESQL functions in Figure 5 8 on page 5 15 support Description December 27 1991 prints as Taiwanese Ming Guo date 80 12 27 Taiwanese Ming Guo date 0080 12 27 Japanese era with abbreviated era symbols HO3 12 27 Japanese era with abbreviated era symbols H0003 12 27 Japanese era with full era symbols AtA2B1B203 12 27 Japanese era with full era symbols AA2B1B20003 12 27 In addition to the formats in the preceding table these ESQL DATETIME format functions support the GLS date and time specifiers For a list of these specifiers see the description of the GL_DATE and GL_DATETIME environment variables in Chapter 2 GLS Environment Variables 5 16 Informix Guide to GLS Functionality Numeric Format Functions Precedenc
164. ent that uses a type distinct data type name is CREATE DISTINCT Function Function Name An example of an SQL statement that uses a function name is CREATE FUNCTION Opaque data Data Type An example of an SQL statement that uses an type opaque data type name is CREATE OPAQUE TYPE 1 of 2 4 8 Informix Guide to GLS Functionality AD XP Generating Non ASCII Filenames SQL Identifier SQL Segment Notes Operator class Expression An example of an SQL statement that uses an operator class name is CREATE OPCLASS Procedure Procedure Name An example of an SQL statement that uses a procedure name is CREATE PROCEDURE Row data type Data Type An example of an SQL statement that uses a row data type name is CREATE ROW TYPE 2 of 2 Generating Non ASCII Filenames The material in this section does not apply to Dynamic Server with AD and XP Options You can use non ASCII characters 8 bit and multibyte characters when you create or refer to any of the following database server names m Chunk name m Message log filename m Pathname The following restrictions affect the ability of the database server to generate filenames that contain non ASCII characters m The database server must know whether the operating system is 8 bit clean m The server code set must support these non ASCII characters When you specify the name of a database table or index SE creates a file that includes the identifier name When you cre
165. entifiers Chunk name Filename Message log filename Pathname Database Server Features 4 7 SQL Identifiers That Support Non ASCII Characters SQL Identifiers That Support Non ASCII Characters If you use a nondefault locale that supports a code set with non ASCII characters you can use these non ASCII characters to form most SQL identi fiers Dynamic Server with UD Option can support non ASCII characters in the following SQL identifiers The SQL identifiers that all Informix database servers support Figure 3 1 on page 3 5 lists the SQL identifiers in which all Informix database servers can support non ASCII characters Some of the SQL identifiers that are unique to Dynamic Server with UD Option Figure 4 1 shows the additional SQL identifiers in which Dynamic Server with UD Option can support non ASCII characters The SQL Identifier column lists the name of the database object The SQL Segment column shows the segment that gives the complete syntax of the identifier in the Informix Guide to SQL Syntax The Notes column describes any special considerations for the identifier and also provides an example of an SQL statement that creates or uses the identifier Figure 4 1 SQL Identifiers Unique to Dynamic Server with UD Option That Support Non ASCII Characters SQL Identifier SQL Segment Notes Cast Expression An example of an SQL statement that uses a cast name is CREATE CAST Distinct data Data Type An example of an SQL statem
166. er you must set the SERVER_LOCALE environment variable to the name of a locale whose code set contains these non ASCII characters For example suppose you want a message log with the UNIX path A A7B B c c pD D where A A B B C C and D D are multibyte characters in the Japanese SJIS code set You must perform the following steps to enable the database server to create this message log file on the server computer 1 Modify the MSGPATH configuration parameter in the ONCONFIG file as shown on page 4 10 2 Set the SERVER_LOCALE environment variable on the server computer to the Japanese SJIS locale ja_jp sjis 3 Start the database server with the oninit utility 4 10 Informix Guide to GLS Functionality w D Generating Non ASCII Filenames When the database server initializes it creates the AlA2B p2 c c p p2 message log For more information on oninit see your Administrator s Guide For example suppose that you want a message log for Dynamic Server Workgroup and Developer Editions with the path C C D D D where C C and D D D are multibyte characters in the Japanese SJIS code set You must perform the following steps to enable Dynamic Server Workgroup and Developer Editions to create this message log file on the server computer 1 Modify the MSGPATH configuration parameter in the ONCONFIG file 2 Set the SERVER_LOCALE environment variable on the server computer to the Japanese SJIS locale ja_jp sj
167. er conventions of the language that you select when you create databases No ONCONFIG configuration parameters exist for GLS but you must set the appropriate environment variables On UNIX platforms set environment variables with the appropriate shell command such as setenv for the C shell For more information refer to your UNIX shell documentation With INFORMIX ESQL C you can use the C putenv function to modify create and delete environment variables and the C getenv function to retrieve the values of environment variables from the operating system environment For details see the INFORMIX ESQL C Programmer s Manual In Windows NT environments set environment variables in the registry with the SETNET32 utility or in the InetLogin structure For more infor mation on SETNET32 see the Windows NT Installation Guide for your product For more information on InetLogin see the Microsoft Windows documen tation for your SQL API With INFORMIX ESQL C you can use the ifx_putenv function to modify create and delete environment variables for the current local process and the ifx_getenv function to retrieve the values of environment variables GLS Environment Variables 2 3 GLS Related Environment Variables 2 4 Important If you use ifx_puteno the application must set all environment variables before it calls any other Informix library routine to avoid initializing the GLS routines and freezing the values of certai
168. er limit Make sure that the database name is 10 or fewer characters that the database code set defines not just that the client code set defines Database Server Features 4 13 Locale Support by Database Server Utilities WIN NT Locale Support by Database Server Utilities The GLS feature enables database server utilities to provide the following locale specific support m Locale environment variables to establish nondefault locales m Non ASCII characters in command line arguments This section provides information that is specific to the use of the GLS feature by database server utilities For a complete description of utilities see your Administrator s Guide For information about how to use Informix utilities to migrate to or from a database server see the Informix Migration Guide For information about database server utilities for auditing see your Trusted Facility Manual Locale Environment Variables Database server utilities and SQL utilities are client applications that request information from an instance of the database server Therefore these utilities use the CLIENT_LOCALE DB_LOCALE and SERVER_LOCALE environment variables to obtain the name of a nondefault locale as follows m Ifa database utility is to use a nondefault code set to accept input including command line arguments and to generate output you must set the CLIENT_LOCALE environment variable m fa database utility accesses a database with a
169. erates an error For information see Establishing a Database Connection on page 1 31 When an Informix product needs to obtain code set conversion information it accesses one of the following GLS code set conversion files depending on the platform m GLScode set conversion files reside in the following file INFORMIXDIR gls cvY codelcode2 cvo m GLS code set conversion files reside in the following file INFORMIXDIR amp Z gls cvY codelcodeZ cvo A 14 Informix Guide to GLS Functionality Code Set Conversion Files In these paths INFORMIXDIR is the environment variable that specifies the directory in which you install the Informix product gls is the subdirectory that contains the GLS files and Y represents the version number for the code set conversion object file format This section describes the remaining elements in the pathname of GLS code set conversion files as follows For information on the code set conversion object cvo and source ev files see page A 15 For information on the name of the code1code2 cvo file see page A 16 For information about which code set conversion files an Informix product must locate see page A 16 Code Set Conversion Source and Object Files Each code set conversion file has the following two forms The code set conversion source file is an ASCII file that describes the mapping to use for one direction of the code set conversion This file has a cv exten
170. erforming Code Set Conversion on page 1 40 GLS Environment Variables 2 7 CLIENT_LOCALE When the client application requests a connection it sends infor mation including the CLIENT_LOCALE to the database server The database server uses CLIENT_LOCALE when it determines how to set the client application information of the server processing locale For more information see Establishing a Database Connection on page 1 31 When database utilities create files the filenames and file contents are in the code set that CLIENT_LOCALE specifies When a client application looks for product specific message files it checks the message directory that is associated with the name of the client locale CLIENT_LOCALE For more information see Locating Message Files on page 1 49 If you do not set CLIENT_LOCALE and DBNLS is also not set the client application uses the default locale U S English as the client locale 2 8 Informix Guide to GLS Functionality DBDATE DBDATE The DBDATE environment variable specifies the end user formats of values in DATE columns For more information on end user formats see page 1 12 Important DBDATE is evaluated at system initialization time If it is invalid the system initialization fails acter DBDATE DBDATE Formats see acter Era Based DBDATE Formats p 2 10 ALS Informix products support the era based extensions in DBDATE for backward
171. ers These code sets are called multibyte code sets Some characters in the Japanese SJIS code set are multibyte characters of 2 or 3 bytes Applications that handle data in multibyte code sets cannot assume that 1 character takes only 1 byte of storage Tip In this manual the term non ASCII characters applies to all characters with a code point greater than 127 Non ASCII characters include both 8 bit and multibyte characters Informix products can support single byte or multibyte code sets For some examples of GLS locales that support non ASCII characters see Supporting Non ASCII Characters on page 1 30 Tip Throughout this manual examples show how single byte and multibyte characters appear Because multibyte characters are usually ideographic such as Japanese or Chinese characters this manual does not use the actual multibyte characters Instead it uses ASCII characters to represent both single byte and multibyte characters For more information about how this manual represents multibyte and single byte characters abstractly see Character Representation Conventions on page 13 of the Introduction GLS Fundamentals 1 9 A GLS Locale The Collation Order Collation involves the sorting of character data that is either stored in a database or manipulated in a client application The collation order affects the following tasks when you select from the database with the SQL SELECT statement m Logical predicates in
172. ers in Delimited Identifiers Multibyte Characters and Identifier Length Using Character Data Types The NCHAR Data Type Collating NCHAR Data Handling NCHAR Data eet Multibyte Characters with NCHAR Treating NCHAR Values as Numeric Values Nonprintable Characters with NCHAR The NVARCHAR Data Type Collating NVARCHAR Data Handling NVARCHAR Data Multibyte Characters with NVARCHAR Nonprintable Characters with NVARCHAR Storing Numeric Values in an NVARCHAR Column Performance Considerations for NCHAR and NVARCHAR Other Character Data Types The CHAR Data Type The VARCHAR Data Type The TEXT Data Type 3 17 3 18 3 20 Collating Character Data Collation Order in CREATE INDEX Collation Order in SELECT Statements The ORDER BY Clause Logical Predicates in a WHERE Claude Comparisons with MATCHES and LIKE Conditions Handling Character Data Specifying Quoted Strings Specifying Comments Specifying Column Substrings Column Substrings in Single Byte Code Sets Column Substrings in Multibyte Code Sets Partial Characters in Column Substrings Specifying Arguments to the TRIM Function Using Case Insensitive Search Functions Using SQL Length Functions The LENGTH Function With Single Byte Code Sets With Multibyte Code Sets The OCTET_LENGTH Function The CHAR_LENGTH Function Handling MONEY Columns Default Values for the Scale Parameter Format of Currency N
173. ers that the column can hold The total number of multibyte characters that you can store in the column is less than the total number of bytes that you can store in the column Make sure to declare the max value of the NVARCHAR column so that it can hold enough characters for your purposes Nonprintable Characters with NVARCHAR An NVARCHAR value can include tabs spaces and nonprintable characters Nonprintable NVARCHAR characters are entered displayed and treated in the same way as nonprintable VARCHAR characters For detailed information on how to enter and display nonprintable characters see the description of the VARCHAR data type in the Informix Guide to SQL Reference Tip The database server interprets the null character ASCII 0 as a C null termi nator Therefore in NVARCHAR data the null terminator acts as a string terminator character Informix Guide to GLS Functionality Performance Considerations for NCHAR and NVARCHAR Storing Numeric Values in an NVARCHAR Column When you insert a numeric value into a NVARCHAR column the database server does not pad the value with trailing blanks up to the maximum length of the column The number of digits in a numeric NVARCHAR value is the number of characters that you need to store that value For example the database server stores a value of 1 in the mytab table when it executes the following SQL statements CREATE TABLE mytab coll VARCHAR 10 INSERT INTO mytab VALUES 1
174. erver processing locale The database server might have to perform code set conversion between the code sets of the server processing locale and the server locale For more information see Performing Code Set Conversion on page 1 40 1 36 Informix Guide to GLS Functionality NLS NLS NLS Establishing a Database Connection The database server uses the following precedence to determine this database information 1 8 The locale that the database server uses to determine the database information for the server processing locale depends on the state of the database to which the client application requests a connection as follows a Foraconnection to an existing database the database server uses the database information from the database locale that it obtains when it verifies the database locale see page 1 33 If the client application does not send DB_LOCALE the database server uses the DB_LOCALE that is set on the server computer b For anew database the database server uses the DB_LOCALE which the client application has sent see page 1 32 LC_COLLATE and LC_CTYPE environment variables that the client application passes if DBNLS is set on the client computer The locale that the DB_LOCALE environment variable on the server computer indicates LC_COLLATE and LC_CTYPE environment variables on the server computer if DBNLS is set on the client computer LANG environment variable on the server comp
175. es and pathnames For example in an ESQL COBOL program the following use of multibyte characters is valid EXEC SQL INCLUDE AlA B B END EXEC Tip Some C language compilers support multibyte characters in literals or com ments only For such compilers you might need to set the ESQLMF and CC8BITLEVEL environment variables so that the ESQL C processor calls a multibyte filter For more information see The esqlmf Filter on page 6 7 To use non ASCII characters in your ESQL source file the client locale must support them Enhanced ESQL Library Functions Informix SQL API products support locale specific enhancements to the ESQL C library functions and ESQL COBOL routines These ESQL library functions fall into the following categories DATE format functions DATETIME format functions Numeric format functions String functions General SQL API Features 5 7 DATE Format Functions 5 8 In addition this section describes the GLS related error messages that these ESQL functions might produce DATE Format Functions The ESQL DATE format functions in Figure 5 1 support the following exten sions to format era based DATE values m Support for the GL_DATE environment variable m Support for era based date formats of the DBDATE environment variable m Extensions to the date format strings for ESQL DATE format functions m Support fora precedence of date end user formats Figure 5 1 ESQUC ESQL COBOL ESQL DATE Forma
176. es not specify a localized order Therefore the database server sorts NCHAR data in code set order When you use the default locale there is no difference between CHAR and NCHAR data Handling NCHAR Data Within a client application always manipulate NCHAR data in the CLIENT_LOCALE of the client application The client application performs code set conversion of NCHAR data automatically if CLIENT_LOCALE differs from DB_LOCALE For information on code set conversion see page 1 40 Multibyte Characters with NCHAR To store multibyte character data in an NCHAR column your database locale must support a code set with these same multibyte characters When you store multibyte characters make sure to calculate the number of bytes that are needed The size parameter of the NCHAR data type refers to the number of bytes of storage that is reserved for the data Because one multibyte character might use several bytes for storage the value of size bytes does not indicate the number of characters that the column can hold The total number of multibyte characters that you can store in the column is less than the total number of bytes that you can store in the column Make sure to declare the size value of the NCHAR column in such a way that it can hold enough characters for your purposes SQL Features 3 13 The NVARCHAR Data Type 3 14 Treating NCHAR Values as Numeric Values If you plan to perform calculations on numbers that are stored in
177. et conversion code set order An acronym for the American Standards Committee for Information Inter change This acronym is often used to describe an ordered set of printable and nonprintable characters used in computers and telecommunication This code set is traditionally used in computer systems found in the United States It contains 128 characters each of which can be represented with 7 bits of information and is the proper subset of every GLS character map and logical unit The smallest computer memory unit often called an octet A logical unit of storage for the value code in a code set It can be represented by one or more bytes and can be a numeric alphabetic or nonprintable char acter control character An application program that requests services from a server program typi cally a file server or a database server The environment that defines the behavior of the client application by speci fying a language a code set and the conventions used for a particular language These conventions can include date time and monetary formats For example to read and write files the client refers to the client locale which is typically specified by the CLIENT_LOCALE environment variable An entry in a code set For example in the ASCII code set the 65th code point is A See code set A character set for a locale A given language has a character set of one or more natural language alphabets plus additional symbols f
178. events the C compiler from ignoring the eighth bit of the A byte If the compiler ignores the eighth bit it incorrectly interprets A octal 244 as octal 044 Invoking the ESQL C Filter Figure 6 1 shows how an ESQL C program that contains non ASCII charac ters becomes an executable program Figure 6 1 Creating an ESQL C Executable Program from a Non ASCII Source Program Eoee eA ESQL C source ESQL C preprocessor ESQLIC filter program Stages 1 and 2 TE Executable C language C source program with program preprocessor SQL statements and and compiler ESQL C calls INFORMIX ESQL C Features 6 9 Invoking the ESQL C Filter The esq command can automatically call the ESQL C filter esqlmf to process non ASCII characters When you set the following environment variables you tell esql how to invoke esqlmf m The ESQLMF environment variable indicates whether esql automat ically calls the ESQL C filter When you set ESQLMF to 1 esql automatically calls esqlmf after the ESQL C preprocessor and before the C compiler see Figure 6 1 on page 6 9 m The CC8BITLEVEL environment variable indicates the non ASCII characters in the ESQL C source file that esqlmf filters Set CC8BITLEVEL to indicate the ability of your C compiler to process non ASCII characters How esqlmf filters an ESQL C source file depends on the value of the CC8BITLEVEL environment variable For each value of CC8BITLEVEL the following table shows the
179. f characters E through P Also assume that the nom column is an NCHAR column The following SELECT statement uses a MATCHES condition in the WHERE clause to pose this query SELECT num ro nom pr nom FROM abonn s WHERE nom MATCHES E P ORDER BY nom Informix Guide to GLS Functionality Collation Order in SELECT Statements The rows for Etaix Otker and verst appear in the query result because in the localized order Figure 3 3 on page 3 24 the accented first letter of each name falls within the E through P MATCHES range for the nom column num ro nom pr nom 13608 Etaix Emile 13607 Hammer Gerhard 13602 Hammerle Greta 13604 LaFor t Jean No l 13610 LeMaitre H loise 13613 Llanero Gloria Dolores 13603 Monta a Jos Antonio 13611 Oatfield Emily 13605 tker Hans J rgen 13614 verst Per Anders If nom is a CHAR column the query result is exactly the same as when nom was an NCHAR column The database server always uses localized order to determine what characters fall within a range regardless of whether the column is CHAR or NCHAR LIKE Condition A LIKE condition also tests for matching character strings As with the MATCHES condition the LIKE condition is true or satisfied when the value of the column to the left of the LIKE keyword matches the pattern that the quoted string specifies to the right of the LIKE keyword You can use only certain symbols as wildcards in the quoted string For more information
180. f the database locale supports a code set that is different from but convertible to the client code set the client performs code set conversion on the data before it sends this data to the database server For more information see Performing Code Set Conversion on page 1 40 The locale also defines the formats for date time numeric and monetary data You can use any format that the client locale supports as a column value in the LOAD FROM file For example a French locale might define monetary values that have a space as the thousands separator and a comma as the decimal separator When you use this locale the following MONEY column value is valid in a LOAD FROM file 3 411 99 You can set environment variables to specify alternative end user formats for date and monetary data If you set these environment variables the LOAD FROM files can use the alternative end user formats for DATE DATETIME and MONEY column values For more information see Customizing Date and Time End User Formats on page 1 50 and Customizing Monetary Values on page 1 53 Unloading Data from a Database The UNLOAD statement writes the rows that a SELECT statement retrieves to an operating system text file This operating system text file is called an UNLOAD TO file The data in this file contains characters that the client code set defines If the client locale supports a multibyte code set this data can contain the multibyte characters If the d
181. file A 12 in server processing locale 1 40 numeric formatting functions 5 19 Numeric notation 1 15 NVARCHAR data type code set conversion 1 48 4 6 collation order 1 12 3 15 description of 3 14 difference from VARCHAR 3 15 in ESQL C program 6 6 in regular expressions 1 5 inserting into database 6 6 multibyte characters 3 16 nonprintable characters 3 16 performance considerations 3 17 sizing 3 14 O o file extension 6 11 OCTET_LENGTH function 3 44 onaudit utility 4 15 4 16 oncheck utility 4 15 4 16 On line manuals Intro 17 onload utility 4 15 4 16 onlog utility 4 15 4 16 onmode utility 1 7 4 19 onpload utility 4 15 onshowaudit utility 4 15 4 16 onspaces utility 4 16 4 17 onstat utility 4 16 4 17 onunload utility 4 16 4 17 onutil utility 4 17 Opaque data type 4 8 Operating system 8 bit clean 2 26 4 12 5 5 character encoding 1 43 compatible locale files A 11 limitations 5 4 locales A 24 need for code set conversion 1 43 saving disk space A 20 Operator class 4 9 ORDER BY clause SELECT 1 10 3 22 Owner name 3 8 P Partial characters 3 37 5 26 Pathname 4 9 Platform icons Intro 8 Precedence See Environment variable PREPARE statement 3 6 Printed manuals Intro 17 Product icons Intro 8 Program group Documentation notes Intro 19 Release notes Intro 19 Q Quoted string 3 10 3 34 R Radix character See Decimal separator Range matches 3 30 rdatestr library function 1 13
182. formix Guide to GLS Functionality Valid Characters in Identifier Names Valid Characters in Identifier Names In the syntax of an SQL identifier a letter can be any character that the alpha class of the locale defines The alpha class lists all characters that are classified as alphabetic For further information on character classification see The CTYPE Category on page A 6 In the default locale the alpha class of the code set includes the ASCII characters in the ranges a to z and A to Z When Informix products use the default locale SQL identifiers can use these ASCII characters wherever letter appears in the syntax of an SQL identifier In a nondefault locale the alpha class of the locale also lists the ASCII characters in the ranges a to z and A to Z It might also include non ASCII characters such as non ASCII digits or ideographic characters For example the alpha class of the Japanese UJIS code set in the Japanese UJIS locale contains Kanji characters When Informix products use a nondefault locale SQL identifiers can use non ASCII characters wherever letter is valid in the syntax of an SQL identifier A non ASCII character is also valid for letter as long as this character is listed in the alpha class of the locale The SQL statements in the following example use non ASCII characters as letters in SQL identifiers CREATE DATABASE march CREATE TABLE quipement code NCHAR 6 description NVARCHAR 128 10 p
183. g flag after each request for a connection If the two database locales do not match the client application might be performing code set conversion incorrectly The client application continues to perform any code set conversion based on the code set that DB_LOCALE supports If you proceed with such a connection it is your responsibility to understand the format of the data that is being exchanged For example suppose your client application has CLIENT_LOCALE set to en_us 1252 and DB_LOCALE set to en_us 8859 1 The client application determines that it must perform code set conversion between the Microsoft 1252 code set in the client locale and the ISO8859 1 code set in the database locale The client application then opens a database with the French fr_fr 8859 1 locale The database server sets SOLWARN7 and uses the locale of the database fr_fr 8859 1 for the localized order of the data However your application might choose to use this connection The code set conversion that the client application performs is still valid because both database locales support the ISO8859 1 code set Instead if the application opens a database with the Japanese SJIS ja_jp sjis locale the database server sets the SQLWARN7 flag and uses the ja_jp sjis locale for the localized order of the data Your application would probably not continue with this connection When the client application started it deter mined that code set conversion was required betwee
184. gory of the server processing locale For more information on these locale categories see page A 4 For more information on how the database server obtains these environment variables see Sending the Client Locale on page 1 32 If the client application makes another request to open a database the database server must reestablish the database information for the server processing locale as follows 1 Reverify the database locale by comparing the database locale in the database to be opened with the value of the DB_LLOCALE environment variable from the client application see page 1 33 2 Reestablish the server processing locale with the newly verified database locale from the preceding step For example suppose that your client application has DB_LOCALE set to en_us 8859 1 U S English with the ISO8859 1 code set The client application then opens a database with the U S English locale en_us 8859 1 and the database server establishes a server processing locale with en_us 8859 1 as the locale that defines the database information If the client application now closes the U S English database and opens another database one with the French locale fr_fr 8859 1 the database server must reestablish the server processing locale The database server sets the SQLWARN7 flag to indicate that the two locales are different However your client application might choose to use this connection because both these locales support t
185. grams gt Informix from the Task Bar Documentation Notes Release Notes Machine Notes In addition to printed documentation the following sections describe the on line files that supplement the information in this manual Please examine these files before you begin using your database server They contain vital information about application and performance issues 18 Informix Guide to GLS Functionality UNIX WIN NT Documentation Notes Release Notes Machine Notes On UNIX platforms the following on line files appear in the directory INFORMIXDIR telease en_us 0333 On Line File Purpose GLSDOC_x y The documentation notes file for your version of this manual describes features that are not covered in the manual or that have been modified since publication Replace x y in the filename with the version number of your database server to derive the name of the documentation notes file for this manual SERVERS_x y The release notes file describes feature differences from earlier versions of Informix products and how these differences might affect current products This file also contains information about any known problems and their workarounds Replace x y in the filename with the version number of your database server to derive the name of the release notes file IDS_x y or The machine notes file describes any special actions that are SE_x y or required to configure and use Informix products on your IUNIVERSAL_x y compu
186. guage Support GLS feature Identifies information that is specific to Dynamic Server and its editions However in some cases the identified section applies only to Informix Dynamic Server and not to Informix Dynamic Server Workgroup and Developer Editions Such information is clearly identified NLS Identifies information that is specific to a Native Language Support NLS database or application Identifies information that is specific to the INFORMIX SE database server Identifies information that is specific to Informix Dynamic Server with Universal Data Option Identifies information that is specific to UNIX platforms W D Identifies information that is specific to Informix Dynamic Server Workgroup and Developer Editions WIN NT Informix Guide to GLS Functionality Identifies information that is specific to the Windows NT environment Icon Conventions These icons can apply to a row ina table one or more paragraphs or an entire section If an icon appears next to a section heading the information that applies to the indicated feature product or platform ends at the next heading at the same or higher level A symbol indicates the end of the feature product or platform specific information that appears within a table or a set of paragraphs within a section Compliance Icons Compliance icons indicate paragraphs that provide guidelines for complying with a standard Icon Des
187. handle locale sensitive data Many user defined functions handle non ASCII data correctly even if they were originally written for ASCII data However some functions might perform abnormally Follow these suggested actions to manage these functions m Ifthe server locale is not supported by the function the function can return an error message Dynamic Server with UD Option provides a new application programming interface API routine to locate the current server locale from within a user function m Ensure that the function works correctly with any locale sensitive issues such as string manipulation or the formatting of date time or money values You can use the functions of INFORMIX GLS to assist you in these tasks For more information see Chapter 7 INFORMIX GLS Features Database Server Features 4 23 Opaque Data Types 4 24 When you create an opaque data type you must write the support functions of the opaque type so that they handle any locale sensitive data In particular consider how to handle any locale sensitive data when you write the following support functions m The input and output support functions m The receive and send support functions The following sections summarize GLS considerations for these support functions For more information on the support functions of an opaque data type see Extending INFORMIX Universal Server Data Types Input and Output Support Functions The internal
188. hat is which code set and collation order In addition DB_LLOCALE specifies the code set conversion if any between the client application and database server On the database server DB_LOCALE specifies how databases are created if this information is not specified by the client application The process of mapping a national character to its numeric representation in a coded character set Character implementations such as UNICODE which assign a fixed number of bytes for each character encoded Fixed width character implementations are also referred to as wide character encoding which typically implies the use of specially defined data types Character implementations which support encoding schemes that allow for single byte characters and multibyte characters to be used simultaneously The simultaneous use of single byte and multibyte characters is achieved by establishing a protocol for recognizing the respective code sets supported in the encoded scheme An example of flexible width character implementation is Extended UNIX Code EUC EUC allows for support of up to four code sets simultaneously In EUC the 7 bit ASCII code set is supported with up to three other code sets for interoperability and compatibility The other three code sets can be encoded as two three or four byte code sets GLS an application environment that allows Informix application program ming interfaces APIs and database servers to handle different language
189. he ISO8859 1 code set If the client application opens a database with the Japanese SJIS locale ja_jp sjis instead of one witha French locale your client application would probably not continue with this connection because the locales are too different Informix Guide to GLS Functionality NLS ALS Establishing a Database Connection Locale Information For the Client Application The database server must know how to interpret the end user formats when they appear in monetary date or time data that the client application sends It must also convert data from the database to any appropriate end user format before it sends this data to the client application For more infor mation about end user formats see page 1 12 The database server uses the following precedence to determine this client application information 1 DBDATE and DBTIME environment variables for the date and time end user formats and DBMONEY for the monetary end user formats if one of these is set on the client 2 GL_DATE and GL_DATETIME environment variables if one of these is set on the client for the date and time end user formats 3 The locale that the CLIENT_LOCALE environment variable from the client application indicates see page 1 32 4 If DBNLS is set on the client computer for an NLS based application a LC_MONETARY LC_NUMERIC and LC_TIME environment variables that the client application passes to define end user formats of monetary numeric
190. he case of a character or compare characters NLS For Version 7 2 and later products the CTYPE locale category replaces the functionality of the NLS environment variable LC_CTYPE The COLLATION Category The COLLATION category defines the localized order When an Informix product needs to compare two strings it first breaks up the strings into a series of collation elements The database server compares each pair of collation elements according to the collation weights of each element The COLLATION category provides support for the following capabilities m Miulticharacter collation elements define characters that the database server should collate as a single unit For example the localized order might treat the Spanish double 1 11 as a single collation element instead of a pair of 1 s m Equivalence classes assign the same collation weight to different collation elements For example the localized order might specify that a and A are an equivalence class a and A are equivalent characters The difference in collation order is the only distinction between the CHAR and NCHAR data types and the VARCHAR and NVARCHAR data types For more information see Using Character Data Types on page 3 12 If a locale does not contain a COLLATION category Informix products use code set order for collation of all character data types CHAR NCHAR NVARCHAR TEXT and VARCHAR NLS For Version 7 2 and later products the COLLATI
191. he client locale the value of CLIENT_LOCALE If DBNLS is set on the client application the client application is to connect to an NLS database server This client application still performs code set conversion between the code sets that the CLIENT_LOCALE and DB_LLOCALE environment variables indicate However if you set DB_LLOCALE and not CLIENT_LOCALE the client application performs code set conversion between the client code set which the LC_CTYPE environment variable indicates or LANG if LC_CTYPE is not set and the database code set which DB_LOCALE indicates GLS Fundamentals 1 45 Performing Code Set Conversion ALS WIN NT UNIX If the Version 9 1 or later client application is to connect to a Version 6 0 ALS database server it sets CLIENT_LOCALE and DB_LOCALE to indicate the client and database locales This client application still performs code set conversion between the code sets that the CLIENT_LOCALE and DB_LOCALE environment variables indicate If the Version 9 1 or later client application is to connect to a Version 5 x ALS database server you must set CLIENT_LOCALE and DB_LOCALE to indicate the client and database code sets In this case the Version 9 1 or later client application performs code set conversion between these two code sets If the client and database code sets are the same no code set conversion is needed However if the code sets do not match the client application must determine whether t
192. he first byte of the white space character and s represents the last byte of the white space character where n has values between two and four For example the following notation represents one 4 byte white space character sls5 s354 Trailing White Spaces Combinations of characters and white spaces can occur in quoted strings in CHAR columns that contain fewer characters than the defined length of the column and in other situations For example if a CHAR 5 column in a single byte code set contains a string of three characters the string is extended with two white spaces so that its length is equal to the defined length of the column as follows abcss The following example shows the representation for a string of five characters three characters of data and two trailing white spaces in a multibyte code set where each of the characters and white space characters consists of two bytes AlA2BIB2CIC2sIs2s s2 Sometimes a string can contain both single byte and multibyte white space characters In the following example the string is composed of these elements three single byte characters abc a single byte white space character s a multibyte white space character s s two single byte white space characters ss and one multibyte white space character s 1 2 2 lez abcss s sss s Informix Guide to GLS Functionality Additional Documentation Additional Documentation For additional information you m
193. he monetary decimal separator m The monetary thousands separator m The number of digits to group between each appearance of a monetary thousands separator m The characters that indicate positive and negative monetary values and the position of these characters before or after m The number of fractional digits those to the right of the decimal point to display Managing GLS Files A 7 Locale Categories This currency notation applies to the end user formats of data from MONEY columns within a client application For more information on end user formats see page 1 12 Important Information in the MONETARY category does not affect the internal format of the MONEY data type in the database The MONETARY category also defines the default scale for a MONEY column For the default locale U S English the database server stores the data type MONEY precision in the same internal format as the data type DECIMAL precision 2 A nondefault locale can define a different default scale For more information on default scales see Default Values for the Scale Parameter on page 3 49 To customize the end user format of monetary values use the DBMONEY environment variable For more information see Customizing Monetary Values on page 1 53 NLS For Version 7 2 and later products the MONETARY locale category replaces the functionality of the NLS environment variable LC_MONETARY The TIME Category The TIME category lists
194. he two code sets are convertible Two code sets are convertible if the client can locate the associated code set conversion files These code set conversion files must exist on the client computer You can use the glfiles utility to obtain a list of code set conversions that your Informix product supports For more information see The glfiles Utility on page A 21 You can examine the INFORMIXDIR gls cvY directory to determine the GLS code set conversions that your Informix product supports For more information on this directory see Appendix A If no code set conversion files exist the client application generates a run time error when it starts up to indicate that the code sets are incompatible If these code set conversion files exist the client application automatically performs code set conversion when it sends data to or receives data from the database server When a client application performs code set conversion it makes the following assumptions m All database data within the client application is handled in the client code set m All databases that the client application accesses on a single database server use the same database locale territory and code set When the client application opens a different database it does not recheck the database locale to determine if the code set has changed 1 46 Informix Guide to GLS Functionality Performing Code Set Conversion Warning Check for the SQLWARN7 warnin
195. hese two code sets are different For more information see Performing Code Set Conversion on page 1 40 m When the client application requests a connection it sends infor mation including the DB_LOCALE if it is set to the database server The database server uses DB_LOCALE when it determines how to set the database information of the server processing locale For more information see Sending the Client Locale on page 1 32 m When a client application tries to open a database the database server compares the value of the DB_LLOCALE environment variable that the client application passes with the database locale that is stored in the database When a database server accesses data in columns with locale specific data types NCHAR NVARCHAR it uses the locale that is saved in the database For more information see Verifying the Database Locale on page 1 33 GLS Environment Variables 2 19 DBMONEY m When the database server creates a database it examines the database locale DB_LOCALE to determine how to store character information in the system catalog of the database If the database locale defines only a code set order for collation like the default locale U S English the database server creates CHAR and VARCHAR columns to store the character information However if the database locale defines a localized order for collation the database server creates NCHAR and NVARCHAR columns to store this chara
196. hname of GLS locale files as follows m For information on the IcX subdirectory and its Ig_tr locale file subdirectories see page A 10 m For information on the locale object lco and source Ic files see page A 11 m For information on the name of the codemodf lco file see page A 12 Locale File Subdirectories The subdirectories of the lcX subdirectory where X represents the version number for the locale object file format contain the GLS locale files These subdirectories have names of the form Ig_tr where Ig is the 2 character language name and tr is the 2 character territory name that the locale supports The GLS locale file subdirectories are in the INFORMIXDIR gls lcX directory for UNIX and in the INFORMIXDIR gls IcX directory for Windows NT The following table shows some languages and territories that Informix products can support along with their associated locale file subdirectory names Language Territory Locale File Subdirectory English United States en_us Great Britain en_gb Australia en_au German Germany de_de Austria de_at Switzerland de_ch French Belgium fr_be Canada fr_ca Switzerland fr_ch France fr_fr Informix Guide to GLS Functionality NLS Location of Locale Files Version 7 2 and later products also provide GLS locales that are compatible with many operating system locales These locale files reside in the os subdi rectory of the IlcX subdirectory in your Informix in
197. iables 2 29 GL_DATE White space or other nonalphanumeric characters must appear between any two formatting directives For example if you use a U S English locale you might want to format an internal DATE value for 03 05 1997 in the ASCII string format that the following example shows Mar 05 1997 Wednesday To do so set the GL_DATE environment variable as follows Zab 4d Y RA If a GL_DATE format does not correspond to any of the valid formatting directives the behavior of the Informix product when it tries to format is undefined Tip The GL_LDATETIME environment variable accepts these date formatting direc tive in addition to those that the section on page 2 37 lists The Year Formatting Directives You can use the following formatting directives in the end user format of the GL_DATE environment variable to format the year of a date string y iy Y and iY The iy and iY formatting directives provide compatibility with the Y2 and Y4 year specifiers of the DBDATE environment variable When an Informix product uses an end user format to print an internal date value as a string the iy and iY formatting directives perform the same task as y and Y respectively To print a year with one of these formatting directives an Informix product performs the following actions m The iy and y formatting directives both print the year of an internal date value as a 2 digit decade For example when you set GL_DATE to
198. ic 1 36 locator structure 6 12 LVARCHAR 4 22 MONEY 1 14 NCHAR 1 48 3 12 4 6 6 6 numeric 1 14 A 7 NVARCHAR 3 14 6 6 NVARCHAR data type 1 48 4 6 opaque 4 23 SMALLFLOAT 1 14 A 7 SMALLINT 1 14 A 7 smart large objects 4 22 SQL 92 4 21 TEXT 1 48 3 20 4 6 VARCHAR 3 19 VARCHAR data type 1 48 4 6 See also individual data type names Database loading 3 53 migrating from GLS 4 19 naming 3 6 4 9 4 13 5 7 saving locale information 1 26 SE names 4 9 4 12 unloading 3 53 Database code set 1 41 1 45 1 46 Database conversion 1 26 4 19 Database cursor See Cursor Database locale code set See Database code set database code set 1 41 in system catalog 1 26 1 33 incompatible 1 33 sample 1 23 1 27 1 35 4 Informix Guide to GLS Functionality saving 1 26 setting 1 28 uses of 1 36 verifying 1 33 1 38 2 19 See also DB_LLOCALE environment variable Database objects 1 6 3 4 Database server code set conversion 1 47 collation 1 12 data types 4 20 determining server processing locale 1 31 1 34 end user formats 1 13 internal formats 1 12 interpreting character data 1 26 setting a locale 1 18 1 28 support for locales 1 5 1 7 uses of client locale 1 24 1 31 1 32 uses of database locale 1 26 uses of server locale 1 27 4 3 using DB_LOCALE 2 20 utilities 1 6 verifying a connection 1 31 5 24 verifying database locale 1 33 1 38 See also Informix Dynamic Server Database ser
199. ich rows to update In addition the SET clause can include an embedded SELECT statement whose WHERE clause identifies a row whose values are to be assigned to another row For the UNLOAD statement the WHERE clause of the embedded SELECT specifies which rows to unload The choice of a locale affects these uses of a WHERE clause in the same way that it affects the WHERE clause of a SELECT For more information see Logical Predicates ina WHERE Clause on page 3 25 and Comparisons with MATCHES and LIKE Conditions on page 3 29 Specifying Era Based Dates The following SQL statements might specify DATE and DATETIME column values The WHERE clause of the DELETE statement The VALUES clause of the INSERT statement The SET clause of the UPDATE statement SQL Features 3 51 Loading and Unloading Data 3 52 When you specify a DATE column value in one of the preceding SQL state ments the database server uses the GL_DATE or DBDATE environment variable to interpret the date expression as follows m If you have set GL_DATE or DBDATE to an era based Asian date format you can use era based date formats for date expressions m Ifyou have not set the GL_DATE or DBDATE environment variable to an era based date format you can use era based date formats for date expressions only if the server processing locale supports era based dates For more information on the server processing locale see Determining the Server P
200. icrosoft 1252 code set both the fr_fr and en_us locale file subdirectories contain a 04e4 lc locale file as well Figure A 2 on page A 23 shows the output that the glfiles utility generates for locale files Tip To save disk space you might want to keep only those locale files that you intend to use For information on which locale files you can remove refer to Removing Locale and Code Set Conversion Files on page A 20 Managing GLS Files A 13 Other GLS Files WIN NT WIN NT Other GLS Files In addition to GLS locale files Informix products might also use the following GLS files m Code set conversion files map one code set to another m Code set files define code point values for code sets m The Informix registry file converts locale aliases to valid locale filenames This section describes each of these types of GLS files For information on GLS locale files see page A 3 Code Set Conversion Files The code set conversion file describes how to map each character in a particular source code set to the characters of a particular target code set Informix products can perform a given code set conversion if code set conversion files exist to describe the mapping between the two code sets Important A client application checks the code sets that the client and database locales support when it begins execution If code sets are different and no code set conversion files exist the client application gen
201. ient application first begins execution it compares the client and database locales to determine if it needs to perform code set conversion m All Informix products that display product specific messages look in a directory specific to the client locale to locate these messages Supporting Non ASCII Characters An Informix product determines which code set it uses from the name of a GLS locale Informix provides locales that support both single byte and multibyte code sets All code sets that Informix supports define the ASCII characters Most also support additional non ASCII characters 8 bit or multibyte characters For more information on code sets and non ASCII characters see page 1 8 The following types of GLS locales are examples of locales that contain non ASCII characters in their code sets m The default locale supports the default code set which contains 8 bit characters for non English characters such as fi and 6 The name of the default code set depends on the platform on which your Informix product is installed For more information on the default code set page 1 19 Informix Guide to GLS Functionality UNIX Establishing a Database Connection m Many nondefault locales support the default code set Nondefault locales that support the UNIX default code set IS08859 1 include British English en_gb 8859 1 French fr_fr 8859 1 Spanish es_es 8859 1 and German de_de 8859 1 m Other nondefau
202. ight want to refer to the following types of documentation On line manuals Printed manuals Error message files Documentation notes release notes and machine notes Related reading On Line Manuals An Answers OnLine CD that contains Informix manuals in electronic format is provided with your Informix products You can install the documentation or access it directly from the CD For information about how to install read and print on line manuals see the installation insert that accompanies Answers OnLine Printed Manuals To order printed manuals call 1 800 331 1763 or send email to moreinfo informix com Please provide the following information when you place your order m The documentation that you need m The quantity that you need m Your name address and telephone number Introduction 17 Error Message Files UNIX WIN NT Error Message Files Informix software products provide ASCII files that contain all of the Informix error messages and their corrective actions For a detailed description of these error messages refer to Informix Error Messages in Answers OnLine To read the error messages under UNIX you can use the following commands Command Description finderr Displays error messages on line rofferr Formats error messages for printing To read error messages and corrective actions under Windows NT use the Informix Find Error utility To display this utility choose Start gt Pro
203. il our address is doc informix com Or send a facsimile to the Informix Technical Publications Department at 650 926 6571 We appreciate your feedback Introduction 21 GLS Fundamentals What Is the GLS Feature GLS Support by Informix Products Informix Database Servers Informix Client Applications and Utilities Additional GLS pene 3 A GLS Locale ACodeSet The Collation Order End User Formats How Do You Set a GLS Locale The Default Locale The Default Code Set Default Date and Time End ae Formats Default Numeric and Monetary End User Formats GLS Locale Names Locales in the Client Server Environment The Client Locale The Database Locale The Server Locale A Nondefault Locale How Do Informix Products Use GLS Locales Supporting Non ASCII Characters Establishing a Database Connection Sending the Client Locale Verifying the Database Locale of af Determining the Server Processing Locale 1 5 1 5 1 7 1 8 1 8 1 10 1 12 1 18 1 18 1 19 1 19 1 19 1 20 1 22 1 23 1 26 1 27 1 28 1 30 1 30 1 31 1 32 1 33 1 34 1 2 Performing Code Set Conversion What Is Code Set Conversion When Is Code Set Conversion Performed Which Data Is Converted Locating Message Files How Do You Customize Client End User Formats Customizing Date and Time End User Formats Era Based Date and Time Formats Date and Time Precedence Customizing Monetary
204. iling white spaces in the byte count whereas LENGTH generally excludes trailing white spaces from the byte count The advantage of the OCTET_LENGTH function over the LENGTH function is that the OCTET_LENGTH function provides the actual column size whereas the LENGTH function trims the column values and returns the length of the trimmed string This advantage of the OCTET_LENGTH function applies both to single byte code sets such as ISO8859 1 and multibyte code sets such as the Japanese SJIS code set The following table shows some results that the OCTET_LENGTH function might generate OCTET_LENGTH Input String Description Result abc A quoted string with 4 single byte characters the 4 characters abc and 1 trailing space Al a2p p A quoted string with 2 multibyte characters 4 aA A bB B A quoted string with 2 single byte and 2 multibyte 6 characters The CHAR_LENGTH Function The CHAR_LENGTH function also known as the CHARACTER_LENGTH function returns the number of characters in a quoted string column with a character data type host variable or procedure variable However the actual behavior of this function varies with the type of argument that the user specifies The following table shows how the CHAR_LENGTH function operates on each of the argument types The Example column in this table uses the symbol s to represent a single byte trailing white space For simplicity the Example column also assumes that the
205. in a client appli cation when it is in literal strings or character variables End user formats are useful for data types whose format in the database is different from the format to which users are accustomed In a database the database server stores data for DATE DATETIME MONEY and numeric data types in compact internal formats For example the database server stores a DATE value as an integer number of days since the date of December 31 1899 so the date 03 19 96 is 35142 This internal format is not very intuitive 1 12 Informix Guide to GLS Functionality A GLS Locale Informix products support end user formats so that a client application can use this more intuitive form instead of the internal format Literal strings or character variables can appear in SQL statements as column values or as arguments of SQL API library functions An Informix product uses an end user format when it encounters a string a literal string or the value in a character variable in the following contexts When an Informix product scans a string it uses an end user format to determine how to interpret the string so that it can convert it to a numeric value For example suppose that DB Access has the default locale U S English as its client locale The literal date in the following INSERT statement uses the end user format for dates that the default locale defines INSERT INTO mytab datel VALUES 03 19 96 When the database server rec
206. in alphabetical sequences that represent strings of single byte characters The manual reserves the letter s as a symbol that repre sents a single byte white space character For further information see White Space in Strings on page 15 Multibyte Characters This manual does not attempt to show the actual appearance of multibyte characters in text examples or diagrams Instead the following convention shows abstractly how multibyte characters are stored Al A One to four identical uppercase letters each followed by a different super script number represent one multibyte character The superscripts show the first to the nth byte of the multibyte character where n has values between two and four For example the following symbols represent a multibyte character that consists of two bytes ALA The following notation represents a multibyte character that consists of four bytes the maximum length of a multibyte character ALAZASA4 Informix Guide to GLS Functionality Character Reoresentation Conventions The following example shows a string of multibyte characters in an SQL statement CREATE DATABASE A1A2B1B2C C2p p2E1E2 This statement creates a database whose name consists of five multibyte characters each of which is two bytes long For more information on how to use multibyte characters in SQL identifiers see Naming Database Objects on page 3 4 Single Byte and Multibyte Characters i
207. index on an NVARCHAR column the maximum size is 254 bytes You can store shorter but not longer character strings than the value that you specify Informix Guide to GLS Functionality The NVARCHAR Data Type You can optionally specify the minimum reserved space reserve parameter This value can range from 0 to 255 bytes but must be less than the maximum size max of the NVARCHAR column If you do not specify a minimum space value the default value of reserve is 0 Specify the reserve parameter when you initially intend to insert rows with short or null data in this column but later expect the data to be updated with longer values Although use of NVARCHAR economizes on space that is used in a table it has no effect on the size of an index In an index that is based on an NVARCHAR column each index key has a length equal to max bytes the maximum size of the column The database server does not strip an NVARCHAR object of any user entered trailing spaces nor does it pad the NVARCHAR object to the full length of the column However if you specify a minimum reserved space reserve and some of the data values are shorter than that amount some of the space that is reserved for rows goes unused For the complete syntax of the NVARCHAR data type see the Data Type segment in the Informix Guide to SQL Syntax The INFORMIX SE database server does not support the NVARCHAR data type Collating NVARCHAR Data The NVARCHAR data typ
208. ing system files 5 4 with CC8BITLEVEL 2 6 with ESQLMF 2 24 6 10 ESQL C program accessing NCHARs 6 6 accessing NVARCHARs 6 6 checking database connection 1 33 5 25 comments 2 5 5 7 compiling 6 9 6 11 data type constants 6 13 6 17 6 18 filenames 5 7 handling code set conversion 6 12 host variables 1 23 5 6 indicator variables 5 6 literal strings 1 13 1 23 2 5 5 7 non ASCII source code 5 6 writing blobs to database 6 12 See also Client application ESQL COBOL processor 2 27 5 4 ESQL COBOL program checking database connection 1 33 5 25 comments 5 7 filenames 5 7 host variables 1 23 5 6 indicator variables 5 6 literal strings 1 13 1 23 5 7 non ASCII source code 5 6 See also Client application ESQL COBOL routine library DATE format routines 5 8 5 9 5 10 DATETIME format routines 5 15 ECO DAT 5 8 5 9 ECO DEF 5 8 5 10 ECO DSH 5 23 ECO DTCVASC 5 15 ECO DTTOASC 5 15 ECO FEL 5 17 ECO FIN 5 17 ECO FMT 5 8 5 10 ECO STR 5 8 5 9 ECO USH 5 23 era based dates 5 9 5 10 precedence for DATE data 5 14 Explain file 1 27 Extension to SQL symbol for Intro 9 F Feature icons Intro 8 Features product Intro 5 FETCH statement 3 6 File cmZ txt A 26 code set conversion See Code set conversion file code set See Code set file evY txt A 25 diagnostic 1 27 4 3 ESQL source 5 4 Informix proprietary 1 28 lcX txt A 22 A 24 LOAD FROM 3 53 locale object file A 11 locale source file A 1
209. ings The condition is true or satisfied when the value of the column to the left of the MATCHES keyword matches the pattern that a quoted string specifies to the right of the MATCHES keyword You can use wildcard characters in the string For example you can use brackets to specify a range of characters For more information on MATCHES see the Condition Segment in the Informix Guide to SQL Syntax When the MATCHES condition does not list a range of characters in the string it specifies a literal match For literal matches the data type of the column determines whether collation considerations come into play as follows m For CHAR and VARCHAR columns no collation considerations come into play m For NCHAR and NVARCHAR columns collation considerations might come into play because these data types use localized order and the locale might define equivalence classes of collation For example the localized order might specify that a and A are an equivalent class That is they have equal weight in the collation sequence For further information on localized order see page 1 11 SQL Features 3 29 Collation Order in SELECT Statements 3 30 The examples in the following table illustrate the different results that CHAR and NCHAR columns produce when a user specifies the MATCHES keyword without a range in a SELECT statement These examples assume use of a nondefault locale that defines A and a in an equivalence class It also ass
210. ints as Japanese era Abbreviated era year nyymmdd H021005 Full era year nnnnyy mm dd Ala202 10 05 nnnnyymmdd ww A1A7021005 B1B In addition to the era based combinations in Figures 5 4 through Figure 5 7 the format string also supports the combinations that the INFORMIX ESQL C Programmer s Manual and the INFORMIX ESQL COBOL Programmer s Manual describe for these functions Precedence for Date End User Formats The ESQL DATE format functions use the following precedence to determine the end user format for values in DATE columns 1 The end user format that DBDATE specifies if DBDATE is set 2 The end user format that GL_DATE specifies if GL_DATE is set 3 The date end user format that the client locale specifies if CLIENT_LOCALE is set 4 The date end user format from the default locale m d iY For more information on the precedence of DBDATE GL_DATE and CLIENT_LOCALE refer to Customizing Date and Time End User Formats on page 1 50 Tip Informix products support DBDATE for backward compatibility with earlier products Informix recommends the use of the GL_DATE environment variable for new client applications Informix Guide to GLS Functionality DATETIME Format Functions DATETIME Format Functions The ESQL DATETIME format functions in Figure 5 8 support the following extensions to format era based DATETIME values m Support for the GL_DATETIME environment variable m Support for era based
211. ironment that defines the behavior of the program at runtime The rules are usually based on the linguistic customs of the region or the territory GLS library based products use GLS locales that Informix defines and prepro cesses for customers Customers are not able to modify Informix locales The locale can be set through an environment variable that dictates output formats for numbers currency symbols dates and time as well as collation order for character strings and regular expressions The process of adapting an internationalized product to a specific cultural environment abbreviated L10n This process usually involves the creation of culturally specific resource files the selection of message catalogs the setting of date time and money formats and the translation of the product user interface It might also include the translation and production of end user documentation packaging and collateral materials The files and documentation that Informix supplies a localization center to enable translation to localize for the following products ESQL C ESQL COBOL INFORMIX SE Dynamic Server Dynamic Server with AD and XP Options Dynamic Server with UD Option and Dynamic Server Work group and Developer Editions 4 Informix Guide to GLS Functionality multibyte character native language NLS NLS Open Implicit Explicit OPEN NLS A character that might require from two to four bytes of storage If a language contai
212. is 3 Start the database server When the database server initializes it creates the C C D D D message log For more information on message log files and initialization see your Admin istrator s Guide For example suppose you want an INFORMIX SE message log with the path c ce p p D where C C and D D2D are multibyte characters in the Japanese SJIS code set You must perform the following steps to enable SE to create this message log file from within a client application 1 Set the SERVER_LOCALE environment variable on the server computer to the Japanese SJIS locale ja_jp sjis 2 Set the CLIENT_LOCALE environment variable on the client computer to the Japanese SJIS locale ja_jp sjis or to a locale that supports a convertible code set For more information see Performing Code Set Conversion on page 4 5 3 Start the client application from which you execute the following SQL statement CREATE DATABASE A A B B WITH LOG IN C1C2p p2p3 When SE executes this CREATE DATABASE statement it can support the Japanese SJIS characters in the database name and the message log file For more information on CREATE DATABASE see the Informix Guide to SQL Syntax amp Database Server Features 4 11 Generating Non ASCII Filenames The GLS8BITFSYS Environment Variable The GLS8BITFSYS environment variable on the server computer tells the SE database server whether the operating system is 8 bit clean SE uses the v
213. lient code set the code set of the client locale The ESQL C preprocessor esqlc can accept non ASCII characters 8 bit and multibyte in the ESQL C source code as long as the client code set defines them However the capabilities of your C compiler might limit your ability to use non ASCII characters within an ESQL C source file If the C compiler does not fully support non ASCII characters it might not successfully compile an ESQL C program that contains these characters To provide support for common non ASCII limitations of C compilers ESQL C provides an ESQL C filter that is called esqlmf INFORMIX ESQL C Features 6 7 Filtering Non ASCII Characters 6 8 This section provides the following information about the ESQL C filter m How the ESQL C filter processes non ASCII characters m How you invoke the ESQL C filter Filtering Non ASCII Characters As part of the compilation process of an ESQL C source program the ESQL C processor calls the C compiler When you develop ESQL C source code that contains non ASCII characters the way the C compiler handles such characters can affect the success of the compilation process In particular the following situations might affect compilation of your ESQL C program m Multibyte characters might contain C language tokens A component of a multibyte character might be indistinguishable from certain single byte characters such as percent comma backslash and double quote
214. llowing table shows which of these host variable data types you can use for NCHAR and NVARCHAR data Locale Sensitive Data Type char fixchar string varchar NCHAR Vv v Vv Vv NVARCHAR Vv Vv v Tip For general information on how to use these host variable data types with character data see the INFORMIX ESQL C Programmer s Manual INFORMIX ESQL C Features 6 5 Locale Sensitive Character Data Types 6 6 Your ESQL C program can access columns of data types NCHAR and NVARCHAR when it selects into or reads from character host variables The following code fragment declares a char host variable h te and then selects NCHAR data into the h te variable This code fragment declares a char host variable h te which contains a non ASCII character in the name and selects NCHAR data non ASCII names in the nom column of the abonn s table into it EXEC SQL BEGIN DECLARE SECTION char h te 10 EXEC SQL END DECLARE SECTION EXEC SQL select nom into h te from abonn s where num ro gt 13601 When you declare ESQL C host variables for the NCHAR and NVARCHAR data types keep in mind the relationship between the declared size of the variable and the amount of character data that it can hold as follows m If your locale supports a single byte code set the size of the NCHAR and NVARCHAR variable determines the number of characters that it can hold m If your locale supports a multibyte code set y
215. lt locales such as Japanese SJIS ja_jp sjis Korean ko_kr ksc and Chinese zh_cn gb contain multibyte code sets For the contexts in which you can use non ASCII characters including multibyte characters see Chapter 3 SQL Features Chapter 4 Database Server Features and Chapter 5 General SQL API Features However for an Informix product to support non ASCII characters it must use a locale that supports a code set with these same non ASCII characters Establishing a Database Connection When a client application requests a connection to a database the database server uses GLS locales to perform the following steps 1 Examine the client locale information that the client passes 2 Verify that it can establish a connection between the client appli cation and the database that it requested 3 Determine the server processing locale which the database server uses to handle locale specific information for the connection GLS Fundamentals 1 31 Establishing a Database Connection NLS ALS 1 32 Sending the Client Locale When the client application requests a connection it sends the following environment variables from the client locale to the database server Locale information Q CLIENT_LOCALE and DB_LOCALE If CLIENT_LOCALE is not set and DBNLS is not set the client sets it to the default locale If DB_LOCALE is not set and DBNLS is not set the client does not send a DB_LOCALE value
216. ly set the loc_type field of the blob as follows m Fora TEXT blob the ESQL C client application must set the loc_type field to SQLTEXT before the INSERT statement The client performs code set conversion on TEXT blob data before it sends this data to the database for insertion m Fora BYTE blob the ESQL C client application must set the loc_type field to SOLBYTES before the INSERT statement The client does not perform code set conversion on BYTE blob data before it sends this data to the database for insertion Important The sqltypes h header file defines the data type constants SQLTEXT and SQLBYTES You must include this header file in your ESQL C source file to use these constants For more information on the sqltypes h header file see the INFORMIX ESQL C Programmer s Manual Your ESQL C source code does not need to set loc_type before it reads blob data from a database The database server obtains the data type of the blob from the database and sends this data type to the client with the data INFORMIX ESQL C Features 6 13 Using the DESCRIBE Statement 6 14 If you set loc_bufsize to 1 ESQL C allocates memory to hold a single blob value It stores the address of this memory buffer in the loc_buffer field of the loc_t structure If the client application performs code set conversion on TEXT blobs that the database server retrieves ESQL C handles any possible data expansion as follows 1 Frees the existing mem
217. m code set conversion For code set conversion to occur you must set the DBAPICODE environment variable The COLLCHAR environment variable allows client applications to use NLS collation For more information on these two environment variables see the Informix Migration Guide Informix Gateway products on UNIX use the GL_PATH environment variable to override the default locations for GLS code set conversion tables For details see the Version 7 2 or later INFORMIX Enterprise Gateway documentation Client Application Code Set Conversion An Informix client application automatically performs code set conversion between the client and database code sets when the following conditions are true m The code sets that the client and database locales support do not match m A valid object code set conversion exists for the conversion between the client and database code sets When the client application begins execution it compares the names of the client and database locales to determine whether to perform code set conversion If the CLIENT_LOCALE and DB_LOCALE environment variables are set the client application uses these locale names to determine the client and database code sets respectively If CLIENT_LOCALE is not set and DBNLS is not set the client application assumes that the client locale is the default locale If DB_LOCALE is not set and DBNLS is not set the client application assumes that the database locale is the same as t
218. me data it uses the time end user format to determine how to convert this string to the internal integer value for a DATETIME column When an Informix product prints a string that contains time data it uses the time end user format to determine how to format the internal integer value for a DATETIME column as a string In the same way Informix products use the date end user format to scan and print strings for the internal values of the date data types Important The end user formats of the date and time data do not affect the internal format of the DATE or DATETIME data types in the database They affect only how the client application views the data GLS Fundamentals 1 15 A GLS Locale The end user formats for date and time involve characters and symbols that format date and time values This information includes the names and abbre viations for days of the week and months of the year It also includes the commonly used representations for dates time 12 hour and 24 hour and DATETIME values The end user formats can include the names of eras as in the Japanese Imperial date system and non Gregorian calendars such as the Arabic lunar calendar For example the Taiwan culture uses the Ming Guo year format in addition to the Julian calendar year Ming Guo 0001 is equivalent to January 1 1912 on the Julian calendar For dates before 1912 Ming Guo years are negative The Ming Guo year 0000 is undefined any attempt to use it gener
219. ministrators who want to use the GLS environment with Informix products Informix products use the U S 8859 1 English locale as the default locale The default is en_us 8859 1 on UNIX platforms or en_us 1252 Microsoft 1252 for Windows NT environments This default locale supports U S English format conventions for dates times and currency and includes the ASCII code set plus many 8 bit characters such as and This manual is primarily intended for those users who need to use Informix products with a nondefault locale It assumes that you are familiar with Informix database servers and associated products If that is not the case refer to your Getting Started manual If you need more information about your operating system see your system specific documentation Software Dependencies This manual assumes that you are using one of the following Informix products Informix Dynamic Server Version 7 3 Informix Dynamic Server Developer Edition Version 7 3 Informix Dynamic Server Workgroup Edition Version 7 3 Informix Dynamic Server with Advanced Decision Support and Extended Parallel Options Version 8 2 Informix Dynamic Server with Universal Data Option Version 9 1x INFORMIX SE Version 7 2x 4 Informix Guide to GLS Functionality New Features New Features For a comprehensive list of new features see the release notes for your database server Documentation Conventions This section describes the c
220. mn Substrings on page 3 37 Logical Predicates in a WHERE Clause The WHERE clause specifies search criteria and join conditions on the data that you want to select Collation rules affect the WHERE clause when the expressions in the condition are column expressions with character data types and the search condition is one of the following logical predicates Relational operator condition BETWEEN condition IN condition m m m m EXISTS and ANY conditions Relational Operator Conditions The following SELECT statement assumes a nondefault locale It uses the less than lt relational operator to specify that only those rows are to be retrieved from the abonn s table in which the value of the nom column is less than Hammer SELECT num ro nom pr nom FROM abonn s WHERE nom lt Hammer If nom is a CHAR column the database server uses code set order of the default code set to retrieve the rows that the WHERE clause specifies The following sample of output shows that this SELECT statement retrieves only two rows num ro nom pr nom 13612 Azevedo Edouardo Freire 13606 Dupr Mich le Fran oise These two rows are those less than Hammer in the code set ordered data set shown in Figure 3 2 on page 3 23 SQL Features 3 25 Collation Order in SELECT Statements 3 26 However if nom is an NCHAR column the database server uses localized order to sort the rows that the WHERE clause specifies The following sample
221. mn expressions see the Expression segment in the Informix Guide to SQL Syntax SQL Features 3 35 Specifying Column Substrings 3 36 Column Substrings in Single Byte Code Sets Suppose that you want to retrieve the customer_num column and the seventh through ninth bytes of the Iname column from the customer table To perform this query use a column substring for the Iname column in your SELECT statement as follows SELECT customer_num Iname 7 9 as Iname_subset FROM customer WHERE Iname Albertson If the value of the Iname column is Albertson the following sample output shows the result of the query customer_num Iname_subset 114 son Because the locale supports a single byte code set the preceding query seems to return the seventh through ninth characters of the name Albertson However column substrings are byte based and the query returns the seventh through ninth bytes of the name Because one byte is equal to one character in single byte code sets the distinction between characters and bytes in column substrings is not apparent in these code sets Column Substrings in Multibyte Code Sets For multibyte code sets column substrings return the specified number of bytes not number of characters If a character column multi_col contains a string that consists of three 2 byte characters this 6 byte string can be repre sented as follows AlA2B B2c1C2 Suppose that you specified the following column substring
222. n clearly shows the mismatched characters however a two way conversion results in loss of infor mation if mismatched characters are present m Graphical replacement conversion This method maps each mismatched character to a character in the target code set that looks similar to the source character This method includes the mapping of one character ligatures to their two character equivalents and vice versa This method tries to make printing of mismatched data more accurate on the target computer but it most likely confuses the processing of this data on the target computer m A hybrid of two or three of the preceding conversion methods Tip Each code set conversion source file cv indicates how the associated conver sion handles mismatched characters For information on code set conversion files see Appendix A Managing GLS Files 1 42 Informix Guide to GLS Functionality Performing Code Set Conversion When Is Code Set Conversion Performed An application needs to use code set conversion only when the two code sets client and server processing locale or server processing locale and server are different The following situations are possible causes of code sets that differ m Different operating systems might encode the same characters in different ways For example the code for the character 4 a circumflex in Windows Code Page 1252 a common Microsoft code set is hexadecimal 0xE2 In IBM Coded Chara
223. n locale and formatting environment variables For details see the INFORMIX ESQL C Programmer s Manual For detailed information about setting and manipulating GLS and Informix environment variables see the Informix Guide to SQL Reference GLS Related Environment Variables The following table shows an alphabetical list of the GLS related environment variables that you can set for Informix database servers and SQL API products These environment variables are described in this chapter on the pages that are listed in the last column Environment Variable Restrictions Page CC8BITLEVEL ESQL C only 2 5 CLIENT_LOCALE 2 7 DBDATE 2 9 DBLANG 2 16 DB_LOCALE 2 19 DBMONEY 2 20 DBTIME SQL APIs only 2 22 ESQLMF ESQL C only 2 24 GLS8BITFSYS 2 25 GL_DATE 2 27 GL_DATETIME 2 37 SERVER_LOCALE 2 43 Informix Guide to GLS Functionality UNIX CC8BITLEVEL CC8BITLEVEL Informix Gateway products on UNIX use the GL_PATH environment variable to override the default locations for GLS code set conversion tables For details see the Version 7 2 or later INFORMIX Enterprise Gateway documen tation Informix products support many other non GLS environment variables For a complete description of these environment variables refer to the Informix Guide to SQL Reference CC8BITLEVEL The CC8BITLEVEL environment variable indicates the ability of your C language compiler to process non ASCII 8 bit and multibyte characters Th
224. n scale Some examples of an integer data type that the C compiler can scale are short integer short int integer int or long integer long int Glossary 7 Index A ALS See Asian Language Support ALS ALTER TABLE statement 3 12 3 48 Alternative date formats 2 31 Alternative time formats 2 39 ANSI compliance icon Intro 9 level Intro 20 ASCII code set 1 19 Asian date See Era based dates Asian Language Support ALS code set conversion with 1 46 collation order 1 12 DBDATE support 2 9 5 12 DBTIME support 2 22 information in systables 1 26 multibyte data 1 4 precedence of environment variables 1 26 1 38 1 40 reverting to 4 19 Asian language See Multibyte character BETWEEN conditions 3 26 Binary large object blob 1 48 4 6 6 13 See also BYTE data type TEXT data type blob See Binary large object blob BYTE data type code set conversion 1 48 4 6 6 12 partial characters 3 40 See also Binary large object blob C c file extension 5 4 6 11 C compiler 8 bit clean 6 8 limitations 5 5 6 7 multibyte characters 6 7 6 8 non ASCII filenames 5 5 non ASCII source code 6 7 6 8 See also ESQL C compiler Cast 4 8 CC8BITLEVEL environment variable 2 5 5 5 6 10 CCSID code set See IBM CCSID code set CHAR data type code set conversion 1 48 4 6 collation order 1 12 difference from NCHAR 3 13 GLS aspects 3 18 performance considerations 3 17 Character 7 bit 1 8 8 bit 1 9 mismatched 1 42 A
225. n the Informix Guide to SQL Reference A character that is composed of seven bits such as all the char acters of the ASCII code set Single byte characters with code values between 128 and 255 Examples from the ISO8859 1 code set include the non English fi and 6 characters They can be interpreted correctly only if the software that interprets them is 8 bit clean A piece of software or a file system that can process character data that contains 8 bit characters Otherwise only the charac ters of the ASCII code set can be represented and processed correctly in such a system A code set such as JIS X0208 in which approximately 65 000 distinct characters can be encoded All characters that are classified as alphabetic in a code set For example the alpha class of the ASCII code set is the letters a through z and A through Z An acronym for Asian Language System or Asian Language Support ALS refers to a class of products that have been devel oped to operate with multibyte code sets ALS products support various multibyte code sets whose characters are composed of 8 16 24 and 32 bits ALS servers and tools are available for the Version 6 x and earlier family of products These products might have been developed with the GLS Library or other software written specifically to handle Asian language processing ASCII byte character client client locale code point coded character set code set code s
226. n the Microsoft 1252 and 1SO8859 1 code sets The client application performs this code set conversion until it terminates When you open a database with ja_jp sjis the client application would perform code set conversion incorrectly It would continue to convert between Microsoft 1252 and ISO8859 1 instead of between Microsoft 1252 and Japanese SJIS This situation could lead to serious corruption of data Database Server Code Set Conversion An Informix database server automatically performs code set conversion between the code sets of the server processing locale and the server when the following conditions are true m The CLIENT LOCALE DB_LOCALE and SERVER_LOCALE environment variables are set such that the code sets of the server processing locale and the server locale are different m A valid code set conversion exists between the code sets of the server locale and server processing locale GLS Fundamentals 1 47 Performing Code Set Conversion 1 48 For a list of files for which Informix database servers perform code set conversion see Using the Server Locale on page 4 3 For information on GLS code set conversion files see page A 14 Which Data Is Converted When the code sets of two locales differ an Informix product must use code set conversion to prevent data corruption of character data Code set conversion converts the following types of character data SQL data types Q CHAR and VARCHAR a NCHAR and N
227. n the Same String If you are using a multibyte code set a given string might be composed of both single byte and multibyte characters To represent these mixed strings this manual simply combines the formats for multibyte and single byte characters For example suppose that you have a string with four characters The first and fourth characters are single byte characters and the second and third characters are multibyte characters that consist of two bytes each The following format represents this string aAlA2BlB2b White Space in Strings White space is a series of one or more space characters A GLS locale defines what characters are considered to be space characters For example both the TAB and blank might be defined as space characters in one locale but certain combinations of the CTRL key and another character might be defined as space characters in a different locale The convention for representing single byte white spaces in this manual is the letter s The following notation represents one single byte white space S In the ASCII code set an example of a single byte white space is the blank character ASCII code number 32 To represent a string that consists of two ASCII blank characters the manual uses the following notation S5 Introduction 15 Character Representation Conventions 16 The following notation represents a multibyte white space character 1 SE In this format s represents t
228. n the sample connection shown in Figure 1 2 on page 1 23 the database server references the database locale when the client application requests sorted information for an NCHAR column in the acctng database If the database locale is German with the Microsoft 1252 code set de_de 1252 the database server uses a localized order that sorts accented characters such as 6 after their unaccented counterparts This order means that the string f f sorts after ord but before pre The client application uses the database locale as set on the client computer to determine whether to perform code set conversion For more information see Performing Code Set Conversion on page 1 40 The Server Locale The server locale specifies the language territory and code set that the database server uses to perform read and write I O operations on the server computer the computer on which the database server runs These I O operations include reading or writing the following files m Diagnostic files that the database server generates to provide additional diagnostic information m Log files that the database server generates to record events m Explain file sqexplain out that the SQL statement SET EXPLAIN generates GLS Fundamentals 1 27 A Nondefault Locale 1 28 However the database server does not use the server locale to write files that are in an Informix proprietary format database and table files For a more detailed descripti
229. name or other short word that invokes the product or calls the compiler or preprocessor script for a compiled Informix product It might appear alone or precede one or more options You must spell a command exactly as shown and use lowercase letters variable A word in italics represents a value that you must supply such as a database file or program name A table following the diagram explains the value flag A flag is usually an abbreviation for a function menu or option name or for a compiler or preprocessor argument You must enter a flag exactly as shown including the preceding hyphen ext A filename extension such as sql or cob might follow a variable that represents a filename Type this extension exactly as shown immediately after the name of the file The extension might be optional in certain products Punctuation and mathematical notations are literal symbols that you must enter exactly as shown 1 of 2 10 Informix Guide to GLS Functionality Command Line Conventions Element Description ye Single quotes are literal symbols that you must enter as shown Privileges A reference in a box represents a subdiagram Imagine p 5 17 that the subdiagram is spliced into the main diagram at this point When a page number is not specified the subdiagram appears on the same page Standard DBDATE Formats see SQLR A reference to SQLR in this manual refers to the Informix Guide
230. ncatenated For example suppose the multi_col column contains A A2B B2C C2D D2 and the WHERE clause contains the following condition multi_col 2 4 multi_coll6 8 The query does not return any rows because the result of the concatenation A2B B C D D contains two partial characters A and C The Informix database server converts these partial characters to single byte spaces and creates the following WHERE clause condition WHERE sB B sp p AtA2B1BA This condition is also never true so the query retrieves no matching rows Misinterpreting Partial Characters Partial characters present a problem if the substrings strings can be processed or presented to users in any way that makes their concatenation not recon struct the original logical string Possible problem areas include when a substring of one multibyte character is actually a valid character by itself For example suppose a multibyte code set contains a 4 byte character A1A A3A that represents the digit 1 and a 3 byte character A ASA4 that represents the digit 6 Suppose also that you use the locale that contains this multibyte code set when you execute the following query SELECT multi_col FROM tablename WHERE multi_col 2 4 A A A Informix Guide to GLS Functionality Specifying Column Substrings The database server interprets multi_col 2 4 as the valid 3 byte character a multibyte 6 instead of a substring of the valid 4 byte character
231. nment Variables CC8BITLEVEL CLIENT_LOCALE DBDATE DBLANG DB_LOCALE DBMONEY DBTIME ESQLMEF GLS8BITFSYS GL_DATE GL_DATETIME SERVER_LOCALE SQL Features Naming Database Objects Rules for Identifier Names Identifiers That Support Non ASCII Characters p Valid Characters in Identifier Names Non ASCII Characters in Delimited Identifiers Multibyte Characters and Identifier Length Using Character Data Types The NCHAR Data Type The NVARCHAR Data Type Performance Considerations for NCHAR and NVARCHAR z Other Character Data Types Collating Character Data n Collation Order in CREATE INDEX Collation Order in SELECT Statements Handling Character Data Specifying Quoted Strings Specifying Comments Informix Guide to GLS Functionality 1 30 1 30 1 31 1 40 1 49 1 49 1 50 1 53 2 3 2 4 2 5 2 7 2 9 2 16 2 19 2 20 2 22 2 24 2 25 2 27 2 37 2 43 3 4 3 5 3 9 3 10 3 11 3 12 3 12 3 14 3 17 3 18 3 21 3 21 3 22 3 34 3 34 3 35 Chapter 4 Chapter 5 Specifying Column Substrings Specifying Arguments to the TRIM Function Using Case Insensitive Search Functions Using SQL Length Functions The LENGTH Function The OCTET_LENGTH Function The CHAR_LENGTH Function Handling MONEY Columns Default Values for the Scale Param ter Format of Currency Notation Using Data Manipulation Statements Specifying Conditions in the WHERE Clause Specifying Era Based Dates PE
232. not correspond to any of the valid formatting directives the behavior of the Informix product when it tries to format is undefined In addition to the formatting directives that the preceding table lists you can include the following date formatting directives in the end user format of GL_DATETIME ba bA 2b 2B C 2d 2D Ze Sh Ziy iY 4m Sn Zt Sw aX bY bY v For more information on these date formatting directives see the GL_LDATE environment variable on page 2 27 2 38 Informix Guide to GLS Functionality GL_ DATETIME For example if you use an U S English locale you might want to format an internal DATETIME YEAR TO SECOND value to the ASCII string format that the following example shows Mar 21 1997 at 16 h 30 m 28 s To do so set the GL_DATETIME environment variable as the following line shows ab 4d Y at 4H h 4M m S s Important The value of GLLDATETIME affects the behavior of certain ESQL library functions if the DBTIME environment variable page 2 22 is not set For informa tion about how these library functions are affected refer to DDATETIME Format Functions on page 5 15 The value of DBTIME takes precedence over that of GL_DATETIME Alternative Time Formats To support alternative time formats in an end user format GL_LDATETIME accepts the following conversion modifiers m E indicates use of an alternative era format which the locale defines m 0 the letter O indicates use of
233. ns more than 256 characters the code set must contain multibyte char acters Many Asian languages contain 3 000 to 8 000 ideographic characters Such languages have code sets made up of both single byte and multibyte characters a multibyte code set Some characters in the Japanese SJIS code set are multibyte characters of two or three bytes Applications that handle data in a multibyte code set cannot assume that one character requires only one byte of storage The computer user s spoken or written language for example English Chinese German and so on An acronym for Native Language Support or Native Language System Informix limits its use of this term to the support of English and European languages for Informix servers Version 6 x and later Features introduced by Informix Version 6 0 server and connectivity prod ucts The NLS feature was introduced in such a way that all types of client applications could access NLS data from the database server regardless of whether the client itself was able to process the NLS data according to the rules of a locale or whether the client supported the new NCHAR and NVAR CHAR data types introduced by the database server To process these new data types the Informix 6 0 server and connectivity products created three modes by which a client could connect to a database Open NLS Implicit NLS and Explicit NLS These modes are determined by the values of two environment variables DBNLS and COLL
234. ntation for the supported locales and code set conversions If you have enough disk space Informix recommends that you keep these source files for the GLS locales lc and code set conversions cv that your Informix installation supports Removing Code Set Files Informix provides the source version of code set files cm as on line documentation for the locales and code set conversions that use them Because Informix products do not access source code set files you can safely remove them However if you have enough disk space Informix recom mends that you keep these source files for the GLS locales and code set conversions that your Informix installation supports The glfiles Utility To comply with DOS 8 3 naming conventions Informix products use condensed filenames to store GLS locales and code set conversion files These filenames do not match the names of the locales and code sets that the end user uses You can use the gl files utility to generate a more readable list of the following GLS related files m The GLS locales that are available on your system m The Informix code set conversion files that are available on your system m The Informix code set files that are available on your system Managing GLS Files A 21 Listing GLS Locale Files Before you run glfiles take the following steps m Set the INFORMIXDIR environment variable to the directory in which you install your Informix product If you do not set INFOR
235. nual Compliance with Industry Standards The GLS feature for Informix products is based on the X Open XPG4 specifi cations The American National Standards Institute ANSI has established a set of industry standards for SQL Informix SQL based products are fully compliant with SQL 92 Entry Level published as ANSI X3 135 1992 which is identical to ISO 9075 1992 on Informix database servers In addition many features of Informix database server products comply with the SQL 92 Inter mediate and Full Level and X Open SQL CAE common applications environment standards SE Informix SQL based products are compliant with ANSI SQL 92 Entry Level published as ANSI X3 135 1992 on INFORMIX SE with the following exceptions m Effective checking of constraints m Serializable transactions 20 Informix Guide to GLS Functionality Informix Welcomes Your Comments Informix Welcomes Your Comments Please tell us what you like or dislike about our manuals To help us with future versions of our manuals we want to know about corrections or clari fications that you would find useful Include the following information m The name and version of the manual that you are using m Any comments that you have about the manual m Your name address and phone number Write to us at the following address Informix Software Inc SCT Technical Publications Department 4100 Bohannon Drive Menlo Park CA 94025 If you prefer to send ema
236. nvironment variable 3 10 Delimited identifiers 3 10 DESCRIBE statement 6 14 Diagnostic file 1 27 4 3 Distinct data type 4 8 Documentation related Intro 20 terms used in 1 Documentation conventions command line Intro 10 icon Intro 7 sample code Intro 13 typographical Intro 6 Documentation notes Intro 19 Documentation notes program item Intro 19 Documentation types of documentation notes Intro 19 error message files Intro 18 machine notes Intro 19 on line manuals Intro 17 printed manuals Intro 17 related reading Intro 20 release notes Intro 19 Dollar sign as formatting character 5 21 dtcvfmasc library function 5 15 dttofmtasc library function 5 15 E ec file extension 5 4 6 11 eco file extension 5 4 ECO DAT library routine 5 8 5 9 ECO DEF library routine 5 8 5 10 ECO DSH library routine 5 23 ECO DTCVASC library routine 5 15 ECO DTTOASC library routine 5 15 ECO FEL library routine 5 17 ECO FIN library routine 5 17 ECO FMT library routine 5 8 5 10 ECO STR library routine 5 8 5 9 ECO USH library routine 5 23 End user format conversion modifier 2 31 2 39 customizing 1 49 date data 1 15 1 19 1 50 2 23 2 28 2 37 A 9 date format qualifiers 2 33 default 1 19 definition of 1 12 1 50 1 53 extended DATE format strings 5 10 extended DATETIME format strings 5 16 monetary data 1 14 1 19 1 53 2 20 A 8 numeric data 1 14 1 19 A 7 printing 1 13 1 14 1 15 2 35 2 40 scanning 1 13
237. o set environment variables However the following steps are still useful to show how to follow command line syntax Figure 1 on page 12 diagrams the following steps 1 Type the word setenv 2 Type the word INFORMIXC 3 Supply either a compiler name or pathname After you choose compiler or pathname you come to the terminator Your command is complete 4 Press RETURN to execute the command 12 Informix Guide to GLS Functionality Sample Code Conventions Sample Code Conventions Examples of SQL code occur throughout this manual Except where noted the code is not specific to any single Informix application development tool If only SQL statements are listed in the example they are not delimited by semicolons For instance you might see the code in the following example CONNECT TO stores 7 DELETE FROM customer WHERE customer_num 121 COMMIT WORK DISCONNECT CURRENT To use this SQL code for a specific product you must apply the syntax rules for that product For example if you are using the Query language option of DB Access you must delimit multiple statements with semicolons If you are using an SQL API you must use EXEC SQL at the start of each statement and a semicolon or other appropriate delimiter at the end of the statement Tip Ellipsis points in a code example indicate that more code would be added ina full application but it is not necessary to show it to describe the concept being disc
238. ocale Server processing locale Database locale GLS Fundamentals 1 35 Establishing a Database Connection The database server obtains the following information from the server processing locale Locale information for the database This database information includes the localized order and code set for data in columns with the locale specific data types NCHAR and NVARCHAR The database server obtains this information from the name of the database locale that it has just verified see page 1 33 m Locale information for client application data This client application information is the end user formats for date time and monetary data The database server obtains this infor mation from the client application when the client requests a connection see page 1 32 Tip The database server uses the server locale for read and write operations on its own operating system files For information about operating system files see Using the Server Locale on page 4 3 Locale Information for the Database The database server must know how to interpret the data in any columns with the locale specific data types NCHAR and NVARCHAR To handle this locale specific data correctly the database server must know the localized order for the collation of the data and the code set of the data In addition the database server uses the code set of the database locale as the code set of the s
239. ommand line arguments and generate any output in the client code set chkenv dbexport dbload a a dbimport C m dbschema For a description of the chkenv utility refer to the Informix Guide to SQL Reference For a description of the dbload and dbschema utilities refer to the Informix Guide to SQL Tutorial For information about how to use dbexport and dbimport and other SQL utilities to migrate to or froma database see the Informix Migration Guide For information about DB Access see the DB Access User Manual 4 18 Informix Guide to GLS Functionality 1 ol AD XP Enhancements to the onmode Utility Enhancements to the onmode Utility You can use the b option with the onmode utility to revert from a GLS database to an Informix ALS NLS or pre NLS database Important You cannot revert to an ALS Version 5 0 database from a GLS database For information on how to use the onmode utility to migrate to an older version of a database erver see the Informix Migration Guide For a complete description of the onmode utility refer to your Administrator s Guide Using the High Performance Loader High performance parallel loading and unloading for Dynamic Server with AD and XP Options performs table loads and unloads with external tables It uses a series of enhanced SQL statements that you can issue with DB Access or embed in ESQL C High performance loading provides extensive support for loading tables from m
240. on of characters LC_CTYPE category page A 12 Code set specific character Source code set file cm page A 17 mappings Mappings between Source code set conversion file page A 14 characters of the source and cv target code sets Method for character Source code set conversion file page A 14 mismatches during code set cv conversion Code points for characters Source code set file cm page A 17 1 of 2 Informix Guide to GLS Functionality GLS Locale Files Locale Specific Information GLS File to Examine Reference End user formats Numeric non monetary Source locale file 1c Figure A 1 on data LC_NUMERIC category page A 12 Monetary data Source locale file 1c Figure A 1 on LC_MONETARY category page A 12 Date data Source locale file 1c Figure A 1 on LC_TIME category page A 12 Time data Source locale file 1c Figure A 1 on LC_TIME category page A 12 2 of 2 GLS Locale Files The locale file defines a GLS locale It describes the basic language and cultural conventions that are relevant to the processing of data for a given language and territory This section provides the following information about GLS locale files m How the locale file groups locale specific information into locale categories m Where locale files reside and how these locale files are named Managing GLS Files A 3 Locale Categories Locale Category CTYPE COLLATION NUMERIC MONETARY TIME M
241. on of the INFORMIX GLS application programming interface a set of C language functions procedures and macros that allow you to develop internationalized appli cations see the INFORMIX GLS Programmer s Manual For information about the DataBlade API a C language application programming interface that is provided with Dynamic Server with UD Option see the DataBlade API Programmer s Manual INFORMIX ESQL C Features 6 3 Non ASCII Characters in Host Variables 6 4 Non ASCII Characters in Host Variables ESQL C allows the use of non ASCII characters in host variables when the following conditions are true m The client locale supports a code set with the non ASCII characters that the host variable name contains You must set the client locale correctly before you preprocess and compile an ESQL C program For more information see How Do You Set a GLS Locale on page 1 18 m Your C compiler supports compilation of the same non ASCII characters as the source code You must ensure that the C compiler supports use of non ASCII characters in C source code For information about how to indicate the support that your C compiler provides for non ASCII characters see Invoking the ESQL C Filter on page 6 9 ESQL C applications can also support non ASCII characters in comments and SQL identifiers For more information see Non ASCII Characters in ESOL Source Files on page 5 4 The following code fr
242. on of the files that the database server writes in the server locale see Chapter 4 Database Server Features In the sample connection that Figure 1 2 on page 1 23 shows the Informix database server uses the server locale to determine the code set to use when it writes a message log file Tip The database server is the only Informix product that needs to know the server locale Any database server utilities that you run on the server computer use the cli ent locale to read from and write to files and the database locale on the server computer to access databases that are set on the server computer A Nondefault Locale By default Informix products use the U S English locale However Informix products support many other locales To use a nondefault locale you must set the following locale environment variables m Set the CLIENT_LOCALE environment variable to specify a nondefault client locale If you do not set CLIENT_LOCALE the client locale is the default locale U S English m Set DB_LOCALE on each client computer to specify a nondefault database locale for a client application to use when it connects to a database If you do not set DB_LOCALE on the client computer the client application sets the database locale to the client locale This default value keeps the client application from having to perform code set conversion You might also want to set DB_LOCALE on the server computer so that the database server
243. on specifies the maximum number of characters to print If a value supplies more characters than precision specifies an Informix product truncates the value 1 of 2 GLS Environment Variables 2 35 GL_DATE 2 36 EX EY n t X 4m width of 4 4 3d right Informix Guide to GLS Functionality Formatting Directives Description D Values of width and precision affect each element of these formatting directives For example 6 4D prints as follows 6 4m 6 4d 6 4y Ox For formatting directives that include the O modifier alternative digits the value of precision is still the minimum number of digits to print The width value defines the format width rather than the actual number of digits The values of width and precision have no effect on these formatting directives 2 of 2 For example the following formatting directive displays the month as a decimal number with a maximum field width of 4 The following formatting directive displays the day of the month as a decimal number with a minimum field width of 3 and a maximum field The first character of the field specification indicates whether to justify or pad the field value as follows m Ifthe first character is a minus sign an Informix product prints the field value as left justified and pads this value with spaces on the m If the first character is a zero 0 an Informix product prints the field value as right justified and p
244. on the syntax and use of ESQL COBOL numeric format routines see the INFORMIX ESQL COBOL Programmer s Manual Tip For alist of errors that these ESQL numeric format functions might return see GLS Specific Error Messages on page 5 24 Support for Multibyte Characters The ESQL numeric format functions in Figure 5 9 on page 5 17 support multibyte characters in their format strings as long as your client locale supports a multibyte code set that defines these characters However these ESQL functions and routines interpret multibyte characters as literal characters You cannot use multibyte equivalents of the ASCII formatting characters For example the following ESQL C code fragment shows a call to the rfmtlong function with the multibyte character AA in the format string stcopy ALA2 fmtbuf rfmtlong 78941 fmtbuf outbuf printf Formatted value s n outbuf This code fragment generates the following output as long as the client code set contains the AA character Formatting value AlA2 78 941 Informix Guide to GLS Functionality Numeric Format Functions Locale Specific Numeric Formatting The ESQL numeric format functions in Figure 5 9 on page 5 17 require a format string as an argument This format string determines how the numeric format function formats the numeric value A format string consists of a series of formatting characters and the following currency notation Formatting Character Func
245. ondefault locale the client and database locales on your client computer must support this nondefault locale Make sure that these two locales are the same or that their code sets are convertible For more information on convertible code sets see Performing Code Set Conversion on page 1 40 For example to access a database with a Japanese SJIS locale set both the DB_LOCALE and CLIENT_LOCALE environment variables to the ja_jp sjis locale name If you set DB_LLOCALE but do not set CLIENT_LOCALE the client application returns an error because it cannot set up code set conversion between SJIS the database code set and the default code set the code set of the default locale When a client application requests a connection the database server uses information in the client database and server locales to create the server processing locale For more information see Establishing a Database Connection on page 1 31 For information on the syntax of the CLIENT_LOCALE DB_LOCALE and SERVER_LOCALE environment variables refer to those entries in Chapter 2 GLS Environment Variables GLS Fundamentals 1 29 How Do Informix Products Use GLS Locales 1 30 How Do Informix Products Use GLS Locales Informix products use GLS locales for the following tasks m Whena client application requests a connection the database server uses the client and database locales to determine if these locales are compatible m When a cl
246. onventions that this manual uses These conven tions make it easier to gather information from this and other Informix manuals The following conventions are covered Typographical conventions Icon conventions Command line conventions Sample code conventions Character representation conventions Introduction 5 Typographical Conventions 6 Convention KEYWORD Typographical Conventions This manual uses the following standard set of conventions to introduce new terms illustrate screen displays describe command syntax and so forth Meaning All keywords appear in uppercase letters in a serif font italics Within text new terms and emphasized words appear in italics Within syntax diagrams values that you are to specify appear in italics boldface Identifiers names of classes objects constants events functions program variables forms labels and reports environment variables database names filenames table names column names icons menu items command names and other similar terms appear in boldface monospace Information that the product displays and information that you enter appear in a monospace typeface KEYSTROKE Keys that you are to press appear in uppercase letters in a sans serif font Informix Guide to GLS Functionality This symbol indicates the end of feature product platform or compliance specific information within a table or section Tip
247. or digits punctu ation and diacritical marks Each character has at least one code set which maps its characters to unique bit patterns ASCII IS08859 1 Microsoft 1252 and EBCDIC are examples of code sets for the English language A translation of code points from one code set to another such as ASCII to EBCDIC The sequence of characters when sorted in terms of their numerical represen tation and code point value in a code set For example in the ASCII code set uppercase characters A through Z are ordered before lowercase characters a through z 2 Informix Guide to GLS Functionality collation collation order DB_LOCALE encoding fixed width character flexible width character Global Language Support GLS The process of ordering or comparing characters The order or compare process is based on the code set value of the character code set order or on the localized order collated order Full internationalization of sorting and collating functions and support libraries is required in order to correctly and efficiently perform case conversions comparisons and regular expressions such as column1 column2 The sequence of values that specifies some logical ordering in which the char acter fields in a database are sorted and indexed Collation order is also known as collating sequence The database locale On the client the value of DB_LLOCALE specifies how databases are created on the database server t
248. ormats m Thousands separator comma m Decimal separator period m Number of digits between thousands separators 3 m Symbol for positive number plus m Symbol for negative number minus m No alternative digits for era based dates MONETARY The following currency notation for use in monetary end user formats m Currency symbol dollar sign appears before the currency value m Thousands separator comma m Decimal separator period m Number of digits between thousands separators 3 m Symbol for positive number plus m Symbol for negative number minus Default scale for MONEY columns 2 TIME The following date and time end user formats m DATE values m d iy m DATETIME values i m d H M S No definitions for era based dates MESSAGES None 2 of 2 The following sections describe each of these locale categories in more detail Managing GLS Files A 5 Locale Categories The CTYPE Category The CTYPE category defines how to classify the characters of the code set that the locale supports This category includes specifications for which characters the locale classifies as spaces blanks control characters digits uppercase letters lowercase letters and punctuation This category might also include mappings between uppercase and lowercase letters Informix products access this category when they need to determine the validity of an identifier name shift t
249. ormats for DATE and DATETIME values use the E conversion modifier as follows For either GL_DATE or GL_DATETIME E can appear in several formatting directives For a list of valid formatting conversions for eras see Alternative Time Formats on page 2 39 For DBDATE E can appear in the format specification For more information about date specifications see the description of DBDATE in Chapter 2 GLS Environment Variables Date and Time Precedence Informix products use the following precedence to determine the end user format for an internal DATE value 1 2 3 DBDATE GL_DATE Information that the client locale defines CLIENT_LOCALLE if it is set LC_TIME if DBNLS is set GLS Fundamentals 1 51 Customizing Date and Time End User Formats NLS 1 52 1 2 3 LANG if DBNLS is set and LC_TIME is not set If LANG is set but LC_TIME is not the client application sets LC_TIME from the LANG value it does not send LANG to the database server Default date format m d iy if DBDATE GL_DATE and DBNLS are not set and no locale is specified For more information on these formatting directives see the description of GL_DATE on page 2 27 Informix products use the following precedence to determine the end user format for an internal DATETIME value DBDATE and DBTIME GL_DATETIME Information that the client locale defines CLIENT_LOCALE if it is set LC_TIME if DBNLS is set
250. ory that the loc_buffer field references 2 Reallocates a memory buffer that is large enough to store the expanded TEXT data 3 Assigns the address of this new memory buffer to the loc_buffer field 4 Assigns the size of the new memory buffer to the loc_bufsize field If this reallocation occurs ESQL C changes the memory address at which it stores the TEXT blob If your ESQL C program references this address the program must account for the address change ESQL C does not need to reallocate memory for the TEXT data if code set conversion does not expand the TEXT data or if it condenses the data In either of these cases the loc_buffer field remains unchanged and the loc_bufsize field contains the size of the buffer that the loc_buffer field references Using the DESCRIBE Statement The sqlda structure is a dynamic management structure that contains infor mation about columns in dynamic SQL statements The DESCRIBE INTO statement uses the sqlda structure to return information about the select list columns of a SELECT statement It sets the sqlvar field of an sqlda structure to point to a sequence of partially filled sqlvar_struct structures Each structure describes a single select list column For more information about how to determine select list columns see Using an sqlda Structure in the INFORMIX ESQL C Programmer s Manual Informix Guide to GLS Functionality Using the DESCRIBE Statement Each sqlvar_struct st
251. otation Using Data Manipulation Statements Specifying Conditions in the WHERE Clause Specifying Era Based Dates Sg Loading and Unloading Data Loading Data into a Database Unloading Data from a Database 3 2 Informix Guide to GLS Functionality 3 21 3 21 3 22 3 22 3 25 3 29 3 34 3 34 3 35 3 35 his chapter explains how the GLS feature affects the Informix imple mentation of SQL It describes how the choice of a locale affects the following topics m The names that you use for database objects in data definition state ments such as CREATE TABLE and CREATE INDEX m The behavior of character data types such as CHAR VARCHAR NCHAR and VARCHAR m Collation order in the CREATE INDEX and SELECT statements m The use of non ASCII characters in quoted strings comments column substrings and the TRIM function in SELECT and other statements m The SQL length functions m The behavior of the MONEY data type m The behavior of data manipulation statements such as INSERT DELETE and UPDATE and load statements For descriptions of SQL features that are not unique to the GLS feature see the Informix Guide to SQL Syntax For additional information on the Informix implementation of SQL consult the Informix Guide to SQL Reference the Informix Guide to SQL Tutorial and the Informix Guide to Database Design and Implementation Dynamic Server with UD Option extends the functionality of relational databases to an obje
252. ou can no longer assume a one byte per character relationship In this case you must ensure that you declare an ESQL C host variable large enough to accommodate the number of characters that you expect to receive from the database For more information see The NCHAR Data Type on page 3 12 and The NVARCHAR Data Type on page 3 14 You can insert a value that a character host variable char fixchar string or varchar holds in columns of the NCHAR or NVARCHAR data types For more information about how to insert host variables into the NCHAR and NVARCHAR data types see the INFORMIX ESQL C Programmer s Manual Informix Guide to GLS Functionality Extended ESQL C Library Functions Extended ESQL C Library Functions ESQL C includes the following ESQL C library functions that provide GLS support DATE Format DATETIME Format Numeric Format Functions Functions Functions String Functions rdatestr dttofmtasc rfmtdec rupshift rstrdate dtcvfmtasc rfmtdouble rdownshift rdeffmtdate rfmtlong rfmtdate These functions accommodate features of nondefault locales such as locale specific dates and times non ASCII characters and locale specific classifi cation of lowercase and uppercase characters For more information about these enhancements see Enhanced ESQL Library Functions on page 5 7 The esq mf Filter The ESQL C processor esql accepts C source programs that are written in the c
253. ow are numeric and monetary values formatted m How are dates and times formatted m What database locale does the client expect For information on the subset of client locale information that the client program sends see Sending the Client Locale on page 1 32 Checking for Connection Warnings The ESQL client application sends the value of its database locale DB_LOCALE to the database server The database server must verify that this database is compatible with the database locale in the system catalog of the database that the client application wants to open If this comparison fails the database server sets the SQLWARN7 warning flag in the SQLCA structure and uses the database locale in the database system catalog An ESQL client application can check for this warning as follows m AnESQL C client application checks the sqlca sqlwarn sqlwarn7 field m AnESQL COBOL client application checks the SQLWARN7 OF SQLWARN OF SQLCA field If the sqlwarn7 field has a value of W the database server has ignored the database locale that the client specified and has instead used the locale in the database as the database locale Warning If the database server generates a warning when it establishes the connec tion your application should check the SQLCA structure for warnings after a connection If you proceed with such a connection it is your responsibility to under stand the format of the data that is being exchanged General
254. owing information m The U S English language and an English language code set m Standard U S formats for monetary numeric date and time data To use the default locale for your Informix database applications you do not need to perform any special steps However if you want to use a customized version of U S English or British English or even another language you must set environment variables to identify the appropriate locale For infor mation on how to specify a GLS locale see A Nondefault Locale on page 1 28 Informix Guide to GLS Functionality UNIX WIN NT The Default Locale The Default Code Set The default code set is the code set that the default locale supports When you use the default locale the default code set supports both the ASCII code set and some set of 8 bit characters For a chart of ASCII values see the Relational Operator segment in the Informix Guide to SQL Syntax The name of the default code set is platform dependent The default code set on UNIX platforms is ISO8859 1 The default code set for Windows NT environments is Microsoft 1252 Default Date and Time End User Formats When you use the default locale Informix products use the following end user formats for date and time values m For DATE values m d iy For more information on these formatting directives see the description of GL_DATE on page 2 27 m For DATETIME values iY m d H M S For more info
255. pecial date time representation for the era which the Ec formatting directive uses The NUMERIC category of the locale defines the alternative digits for a locale which the Ox formatting directives use For more information on the TIME and NUMERIC categories of a locale see page A 4 GL_DATETIME also supports the era based date formatting directives in an end user format For more information see Alternative Date Formats on page 2 31 Optional Time Format Qualifiers You can specify the following optional format qualifiers immediately after the symbol of the formatting directive A time format qualifier defines a field specification for the time or date and time that the Informix product scans or prints This section describes what a field specification means for the print operation For a description of what a field specification means for the scan operation see page 2 34 For general information on the scan and print operations see End User Formats on page 1 12 2 40 Informix Guide to GLS Functionality GL_ DATETIME When an Informix product uses an end user format to print a string from an internal format the field specification defines the number of characters to print as output This field specification has the following syntax precision F YH l M S p R T F width is a decimal number that indicates a minimum field width for the printed value precision is a decimal numbe
256. products Informix Guide to GLS Functionality DBDATE The following table shows some sample era based DBDATE formats that are compatible with Ascii Corporation 4 0 products In this table the sample outputs for these formats assume that the locale is Japanese ja_jp sjis Description DBDATE Setting October 5 1990 appears as Japanese Imperial era NYMD H02 10 05 NYYMD H02 10 05 MDNYY 10 05 H02 NY2MD H02 10 05 NY2DM H02 05 10 Scanning and Printing Era Based Formats For an Informix product to scan a date string that contains an era based date it expects the DBDATE environment variable to specify the era based format of the value to scan Suppose that you set DBDATE to the following end user format EY2DM An Informix product uses this era based DBDATE format to interpret a date string that it must convert to an internal DATE value as follows E tells the Informix product to expect a multibyte character that represents the era name For the Taiwanese locale zh_tw big5 you can omit the era name from the date string the multibyte character is null Y2 tells the Informix product to expect a year offset for the era This offset can be a 2 digit or a 4 digit numeric value D tells the Informix product to expect a numeric value that represents the day of the month M tells the Informix product to expect either a numeric value that represents the month or the month name which the locale defines The
257. pter 5 General SQL API Features m The INFORMIX GLS application programming interface helps you internationalize your programs For more information see Chapter 7 INFORMIX GLS Features m Database server utilities such as dbexport or onmode allow many command line arguments to include non ASCII characters For more information see Chapter 4 Database Server Features Additional GLS Support Informix products include the GLS locale files to support the default locale U S English and most non Asian locales For more information on the default locale see page 1 18 If you do not find a locale to support your language and territory you must install a Language Supplement for a particular language in addition to your Informix product A Language Supplement provides the locale files and error messages to support a particular language or set of languages The International Language Supplement provides support for all non Asian languages that Informix products support You can obtain support for an Asian language such as Korean Japanese or Chinese with special add on supplements For more information about the Language Supplements contact your Informix sales representative For more information about how to create customized message files see Locating Message Files on page 1 49 GLS Fundamentals 1 7 A GLS Locale A GLS Locale For data to be useful it must be available in the format that the end u
258. r A sample data value in the column might be 12345 678 If you omit the scale parameter from the declaration of a MONEY column the database server provides a scale that the locale defines For the default locale U S English the database server uses a default scale of 2 It stores the data type MONEY precision in the same internal format as the data type DECIMAL precision 2 For example if you define a column as MONEY 10 the database server creates a column with the same format as the data type DECIMAL 10 2 A sample data value in the column might be 12345678 90 For nondefault locales if you omit the scale when you declare a MONEY column the database server declares a column with the same internal format as DECIMAL data types with a locale specific default scale For example if you define a column as MONEY 10 and the locale defines the default scale as 4 the database server stores the data type of the column in the same format as DECIMAL 10 4 A sample data value in the column might be 123456 7890 For the complete syntax of the MONEY data type see the Informix Guide to SQL Syntax For a complete description of the MONEY data type see the Informix Guide to SQL Reference SQL Features 3 49 Format of Currency Notation 3 50 Format of Currency Notation Client applications format values in MONEY columns with the currency notation that the locale defines This notation specifies the currency symbol thousands separa
259. r s standard license unless superseded by negotiated vendor license as prescribed in DFAR 227 7202 Any whole or partial reproduction of software or documentation marked with this legend must reproduce the legend ii Informix Guide to GLS Functionality Chapter 1 Table of Contents Introduction About This Manual Types of Users Software Dependencies New Features eos Documentation E Typographical Conventions Icon Conventions Command Line Conventions Sample Code Conventions Character Representation Conventions Additional Documentation On Line Manuals Printed Manuals Error Message Files Documentation Notes Release Notes Machina Notes Related Reading ae Compliance with Industry Seiridards Informix Welcomes Your Comments GLS Fundamentals What Is the GLS Feature GLS Support by Informix Products A GLS Locale N How Do You Set a GLS aie The Default Locale GLS Locale Names Locales in the Client Server Environment A Nondefault Locale 1 3 1 5 1 18 1 18 1 20 1 22 1 28 iv Chapter 2 Chapter 3 How Do Informix Products Use GLS Locales Supporting Non ASCII Characters Establishing a Database Connection Performing Code Set Conversion Locating Message Files How Do You Customize Client End User Formats Customizing Date and Time End User Formats Customizing Monetary Values GLS Environment Variables Setting and Retrieving Environment Variables GLS Related Enviro
260. r that indicates the precision to use for the field value The meaning of the precision value depends on the particular formatting directive with which it is used as the fol lowing table shows Formatting Directives Description Value of precision specifies the minimum number of digits to print If a value supplies fewer digits than the precision spec ifies an Informix product pads the value with leading zeros The H M and S formatting directives have a default precision of 2 Value of precision specifies the maximum number of charac ters to print If a value supplies more characters than the precision specifies an Informix product truncates the value Values of width and precision affect each element of these formatting directives For example 6 4R prints as follows 6 4H 6 4M Value of precision can follow this directive as an optional precision specification This value must be between 1 and 5 Otherwise an Informix product generates an error This precision value overrides any precision value that you specify between the symbol and the formatting directive 1 of 2 GLS Environment Variables 2 41 GL_ DATETIME Formatting Directives Description OX For formatting directives that include the O modifier value of precision is still the minimum number of digits to print The width value defines the format width rather than the actual number of digits c YEc VEX X The values of width and precision have
261. ra Based Format The ALS 6 0 Era Based Format syntax for DBDATE provides backward compatibility with Informix ALS Version 6 0 products ALS 6 0 Era Based Format gt M D G y2 p A D M Tk E FAS G Y2 at M D E aa D M iG 0 M oe a D E Y4 E Y4 The G and E era year modifiers appear as a prefix to the year specifier to indicate how to format an era as follows m The G era year modifier formats the era as an abbreviated era name m The E era year modifier formats the era as the full era name usually a multibyte character GLS Environment Variables 2 11 DBDATE 2 12 ja_jp sjis DBDATE Description Setting Format with abbreviated era name GY2MD MDGyY2 GY2MD0 GY4DM Format with full era name EY2MD MDEY20 EY2DM EY4MD EY4DM era names Informix Guide to GLS Functionality The following table shows some sample era based DBDATE formats that are compatible with Informix ALS Version 6 0 products In this table the sample outputs for these formats assume that the client locale is Japanese SJIS October 5 1990 appears as H02 10 05 10 05 H02 H021005 H0002 05 10 A A702 10 05 1002A A02 A A702 05 10 A1A70002 10 05 A1A70002 05 10 In the preceding table A1A is a multibyte character in the Japanese SJIS code set that represents the full era name H is an ASCII character that represents the abbreviated era name The Japanese SJIS locale ja_jp sjis defines these DBDATE ALS
262. representation of an opaque data type is the C structure in which it is stored Each opaque type also has a character based format known as its external representation This external representation is stored in an internal data type called LVARCHAR The LVARCHAR data type can store single byte ASCII and non ASCII and multibyte character data Data of an opaque data type can be transferred to and from the database server in this external repre sentation Therefore an opaque data type can hold single byte or multibyte data However the ability to transfer the data between a client application and database server is not sufficient to support locale sensitive data It does not ensure that the data is correctly manipulated at its destination The input and output support functions convert the opaque data type from its internal to an external representation and vice versa The input function converts the external representation of the data type to the internal represen tation The output function converts the internal representation of the data type to the external representation These functions should correctly handle any locale sensitive data In addition they should perform any code set conversion that is required Informix Guide to GLS Functionality Opaque Data Types Send and Receive Support Functions The send and receive functions support binary transfer of opaque data types That is they convert the opaque data type from its in
263. rix_courant MONEY 6 2 Ja CREATE VIEW _va AS SELECT num ro nom FROM abonn s In this example the user creates the following database table and view with French language character names in a French locale such as fr_fr 8859 1 m THE CREATE DATABASE statement uses the identifier march which includes the 8 bit character to name the database m The CREATE TABLE statement uses the identifier quipement which includes the 8 bit character to name the table and the identifiers code description and prix_courant to name the columns SQL Features 3 9 Non ASCII Characters in Delimited Identifiers 3 10 m The CREATE VIEW statement uses the identifier a_va which includes the 8 bit characters and to name the view m The SELECT clause within the CREATE VIEW statement uses the identifiers num ro and nom for the columns in the select list and the identifier abonn s for the table in the FROM clause Both num ro and abonn s include the 8 bit character All of the identifiers in this example conform to the rules for specifying identifiers For these names to be valid the client locale must support a code set with these French characters For the complete syntax and usage of identifiers in SQL statements see the Identifier segment in the Informix Guide to SQL Syntax Non ASCII Characters in Delimited Identifiers A delimited identifier is an identifier that is enclosed in double quotes When the
264. rmation For more information about character classification see the CTYPE category in page A 6 a LC_COLLATE for the localized order For more information about the COLLATE category see page A 6 a LC NUMERIC for numeric end user formats For more information about the NUMERIC category see page A 7 a LC_MONETARY for monetary end user formats For more information about the MONETARY category see page A 7 a LC_TIME for date and time end user formats For more information about the TIME category see page A 8 5 LANG environment variable if on the client DBNLS is set but the associated LC_ is not set 6 The default locale U S English Client applications that are based on Informix Version 9 1 or later products use the precedence of steps 2 3 and 6 in the preceding list You do not need to set the other environment variables for Version 9 1 or later client applica tions Support for DBDATE and DBTIME provides backward compatibility for client applications that are based on earlier versions of Informix products Informix recommends that you use GL_DATE and GL_DATETIME for new applications Support for LANG and the LC_ environment variables provides backward compatibility for client applications that are based on Informix NLS products These applications use the precedence of steps 1 4 5 and 6 in the preceding list You are not required to set CLIENT_LOCALE for NLS based applications However CLIENT_LOCALE does provide ce
265. rmation on these formatting directives see the description of GL_LDATE and GL_DATETIME on pages 2 27 and 2 37 respectively For an introduction to date and time end user formats see Date and Time Formats on page 1 15 For information about how to customize these end user formats see page 1 50 Default Numeric and Monetary End User Formats When you use the default locale Informix products use the following end user formats for numeric and monetary values The thousands separator is the comma The decimal separator is the period Three digits appear between each thousands separator The positive and negative signs are plus and minus respectively GLS Fundamentals 1 19 GLS Locale Names For monetary values Informix products also use the currency symbol which is the dollar sign and which appears in front of a monetary value For an introduction to numeric and monetary end user formats see Numeric and Monetary Formats on page 1 14 For information about how to customize these end user formats see page 1 53 GLS Locale Names A GLS locale name identifies the language territory and code set that you want your Informix product to use This name has the following syntax language territory ee TR modifier code_set is the name of the code set that the locale supports language is the two character name that represents the language for a specifi
266. rocessing Locale on page 1 34 m If your locale does not support era dated dates you cannot use era based date formats for date expressions If you attempt to specify an era based date format in this case the SOL statement fails When you specify a DATETIME column value the database server uses the GL_DATETIME or DBTIME environment variable instead of the GL_DATE or DBDATE environment variable to interpret the expression For more information see Era Based Date and Time Formats on page 1 51 For information on how to set the GL_DATE GL_DATETIME DBDATE and DBTIME environment variables to an era based format see their entries in Chapter 2 GLS Environment Variables Loading and Unloading Data The LOAD and UNLOAD statements allow you transfer data to and from your database with operating system text files The following sections describe the GLS aspects of the LOAD and UNLOAD statements For a complete description of the use and syntax of these statements see the Informix Guide to SQL Syntax Informix Guide to GLS Functionality Loading and Unloading Data Loading Data into a Database The LOAD statement inserts data from an operating system text file into a table or view This operating system text file is called a LOAD FROM file The data in this file can contain any character that the client code set defines If the client locale supports a multibyte code set this data can contain multibyte characters I
267. rogrammer s Manual When the application has character data that might undergo code set conversion you must declare character buffers that can hold the data For more information see Avoiding Partial Characters on page 5 26 6 12 Informix Guide to GLS Functionality Writing TEXT Values Writing TEXT Values The information in this section does not apply to INFORMIX SE or Dynamic Server with UD Option For information on how to write TEXT values in Dynamic Server with UD Option refer to the INFORMIX ESQL C Programmer s Manual INFORMIX SE does not support TEXT and BYTE data types ESQL C uses the loc_t locator structure to read blobs from and write blobs to the database server The loc_type field of this structure indicates the data type of the blob value that the structure describes When the client and database code sets are the same no code set conversion the client appli cation does not need to set the loc_type field explicitly because the database server can determine the blob data type implicitly The database server assumes that character data has the TEXT data type and noncharacter data has the BYTE data type However if the client and database code sets are different and convertible the client application must know the data type of this blob in order to determine whether to perform code set conversion on the blob data Before your ESQL C client application inserts a blob into the database it must explicit
268. ronment variable specifies the client locale which the client application uses to perform read and write operations on the client computer For information about the client locale see page 1 23 Locale Name CLIENT_LOCALE p 1 20 Changes to CLIENT_LOCALE also should be reflected in the Windows NT registry database under HKEY_LOCAL_MACHINE Informix products use the CLIENT_LOCALE environment variable for the following purposes m When the preprocessor for ESQL C or ESQL COBOL processes a source file it accepts C or COBOL source code that is written in the code set of the CLIENT_LOCALE The C compiler and the operating system that you use might impose limitations on the ESQL C program For more information see The esqlmf Filter on page 6 7 m When an ESQL C or ESQL COBOL client application executes it checks CLIENT_LOCALE for the name of the client locale which affects operating system filenames contents of text files and formats of date time and numeric data For more information see Non ASCII Characters in ESQL Source Files on page 5 4 m When a client application and a database server exchange character data the client application performs code set conversion when the code set of the CLIENT_LOCALE environment variable is different from the code set of DB_LOCALE on the client computer Code set conversion prevents data corruption when these two code sets are different For more information see P
269. ronment variable to tell Informix products whether the operating system is 8 bit clean This environment variable deter mines whether an Informix product can use non ASCII characters in the filename of an operating system file that it generates m When you set GLS8BITFSYS to 1 Informix products assume that the operating system is 8 bit clean An Informix product can use non ASCII characters in a filename If you include non ASCII characters in a filename that you specify from within a client application you must ensure that the code set of the server processing locale supports these non ASCII characters If you do not set GLS8BITFSYS Informix database servers behave as if GLS8BITFSYS is set to 1 m When you set GLS8BITFSYS to 0 Informix products assume that the operating system is not 8 bit clean An Informix product does not allow non ASCII characters in filenames If you include non ASCII characters in a filename from within a client application the Informix product uses an internal algorithm to convert these non ASCII characters to ASCII characters The filenames that result are 7 bit clean Filenames with invalid byte sequences generate errors when they are used with GLS based products 2 26 Informix Guide to GLS Functionality GL_DATE Operating System Files That Informix Products Generate The value of the GLS8BITFSYS environment variable affects the filenames of the following types of files that Informix products generat
270. rs However the result of the query is different if the num ro nom and pr nom columns of the abonn s table are defined as NCHAR rather than CHAR SQL Features 3 23 Collation Order in SELECT Statements 3 24 Informix Guide to GLS Functionality Suppose the nondefault locale defines a localized order that collates the data as Figure 3 3 shows This localized order defines equivalence classes for uppercase and lowercase letters and for unaccented and accented versions of the same letter Figure 3 3 Data Set for Localized Order of the abonn Table num ro nom pr nom 13612 Azevedo Edouardo Freire 13601 Alesund Sverre 13600 da Sousa Jo o Louren o Antunes 13615 di Girolamo Giuseppe 13606 Dupr Mich le Fran oise 13608 taix mile 13607 Hammer Gerhard 13602 H mmerle Greta 13604 LaFor t Jean No l 13610 LeMa tre H lo se 13613 Llanero Gloria Dolores 13603 Monta a Jos Antonio 13611 Oatfield Emily 13605 tker Hans J rgen 13614 verst Per Anders 13609 Tiramis Paolo Alfredo The same SELECT statement now returns the query results in localized order because the nom column that the ORDER BY clause specifies is an NCHAR column Collation Order in SELECT Statements The SELECT statement supports use of a column substring in an ORDER BY clause However you need to ensure that this use for column substrings works with the code set that your locale supports For more information see Partial Characters in Colu
271. rtain advantages to your appli cation For more information see the Informix Migration Guide GLS Fundamentals 1 25 Locales in the Client Server Environment ALS NLS ALS 1 26 Client applications that are based on Informix ALS products use the prece dence of steps 1 3 and 6 in the preceding list For more information about how to run ALS based applications see the Informix Migration Guide For information on the CLIENT_LOCALE DBDATE DBTIME DBMONEY GL_DATE and GL_DATETIME environment variables see their entries in Chapter 2 GLS Environment Variables The Database Locale The database locale specifies the language territory and code set that the data base server needs to interpret correctly locale sensitive data types NCHAR and NVARCHAR ina particular database The database locale determines the following information for the database m The code set whose characters are valid in any character column m The code set whose characters are valid in the names of database objects such as databases tables columns and views For more information see Naming Database Objects on page 3 4 m The localized order to collate data from any NCHAR and NVARCHAR columns The database server uses the database locale as one part of the information to determine the server processing locale for the current session For more information see Establishing a Database Connection on page 1 31 The database
272. ructure contains character data for the column name and the column data When the ESQL C client application fills this structure the column name and the column data are in the client code set When the database server fills this structure when it executes a DESCRIBE INTO statement this character data is in the database code set When the client application performs code set conversion between the client and database code sets the number of bytes that is required to store the column name and column data in the client code set might not equal the number that is required to store this same information in the database code set Therefore the size of the character data in sqlvar_struct might increase or decrease during code set conversion To handle this possible difference in size the client application must ensure that it correctly handles the character data in the sqlvar_struct structure The sqidata Field To hold the column data the client application must allocate a buffer and set sqldata to point to this buffer If your client application might perform code set conversion it must allocate sufficient storage to handle the increase in the size of the column data that might occur When the DESCRIBE INTO statement sets the sqllen field the sqllen value indicates the length of the column data in the database code set Therefore if you use the value of sqllen that the DESCRIBE INTO statement retrieves you might not allocate a buffer
273. rver processing locale COLLATION category 1 38 CTYPE category 1 38 date data 1 39 definition of 1 34 determining 1 34 filename checking 4 5 initialization of 1 34 localized order 1 36 MESSAGES category 1 40 MONETARY category 1 40 monetary data 1 39 NUMERIC category 1 40 numeric data 1 39 12 Informix Guide to GLS Functionality precedence of environment variables 1 37 1 39 sample 1 35 TIME category 1 40 time data 1 39 SERVER_LOCALE environment variable database server filenames 4 4 default value 1 28 location of message files 2 18 precedence of 2 18 role in code set conversion 1 47 server code set 1 41 setting 1 28 syntax 2 43 See also Server locale SET EXPLAIN statement 1 27 Single byte character Intro 14 1 4 1 8 3 36 3 39 SMALLFLOAT data type 1 14 A 7 SMALLINT data type 1 14 A 7 Software dependencies Intro 4 Sort order See Collation order Spanish locale 1 31 SQL API products comments 5 7 ESQL library enhancements 5 7 filenames 5 7 handling non ASCII characters 5 4 host variables 5 6 literal strings 5 7 SQL identifier names 5 7 using GLS8BITFSYS 2 27 5 5 SQL functions for case 3 41 SQL identifier delimited 3 10 examples 3 9 multibyte characters 3 5 4 8 non ASCII characters 5 7 owner names 3 8 rules for 3 4 SQL length function CHAR_LENGTH 3 46 classification of 3 41 LENGTH 3 42 OCTET_LENGTH 3 44 using 3 41 SQL segments 3 7 SQL statement CONNECT 3 5 CREATE CAST 4 8 CREATE DISTINCT TYPE 4 8 CREA
274. s cultural conventions and code sets Products labeled GLS use the GLS Library and GLS locales to facilitate locale based processing The GLS library supports text processing and multibyte characters See Global Language Support Glossary 3 International ization 118n 1S08859 1 language supplement local character locale localization L10n localization kit The process of making Informix products easily adaptable to any culture and language abbreviated I18n Among other features internationalized soft ware provides support for culturally specific sorting and for adaptable date time and money formats An internationalized product does not required re compilation of source code for each cultural environment The user simply exchanges resource files and sets up the proper operating environment A code set that contains 256 single byte characters Characters 0 through 127 are the ASCII characters Characters 128 through 255 are mostly characters from European languages for example fi and 6 The result of the product localization process A language supplement for a specific Western European language can be installed with an Informix product to allow the user to see error and warning messages in a language other than English If installed with DB Access the menu names options and on line help for that product also appear in the specific language A character in the native language character set The env
275. s diag 2 dy wate ACB Generating Non ASCII Filenames 2 2 1 AY The Message Log File 2 2 2 1 ww ew ee 410 The Server Code Set a eh dh ck m e e HELO The GLS8BITFSYS Environment Variable ae dt hy ah ows eo oe A Data Portability fs do cae ets Bast a Vy fe aed Naming a Database on INFORMIX SE beohiow amp ted cg Go Bue METS Locale Support by Database Server Utilities 414 Locale Environment Variables ee Sate op Al Non ASCII Characters in Command Line Arguments wee ee ARB Support by SQL Utilities Be ee ee ea eM Ek ax GATS Enhancements to the onmode Utility L ierit poe Soe o AID Using the High Performance Loader 2 1 1 419 Data Types for Dynamic Server with UD eu Hh mie gs Gees mee Se ae F420 SQL 92 Data Types bh ae A SM ee l LVARCHAR Data Type 2 2 2 2 2 we ee ee 422 Smart Large Objects 2 2 1 a ee eee ADD Complex Data Types 2 2 2 1 ew ee eee ADB Opaque Data Types nD besot BH Sd a A23 Input and Output Support Functions 2 HS was 3 Ah ay Gt EA Send and Receive Support Functions 2 2 2 1 425 Distinct Data Types 2 2 1 1 ee eee a a 426 4 2 Informix Guide to GLS Functionality his chapter describes how the Global Language Support GLS feature affects the database server It covers the following main topics When the database server uses the server locale Which database server and SQL
276. s based on characters not bytes Therefore the _ underscore wildcard of the LIKE clause and the wildcard of the MATCHES clause match any one single byte or multibyte character as the following table shows Condition Quoted String Column Value Result LIKE ab_d abcd True LIKE ab_d abA1A d True MATCHES ab d abcd True MATCHES ab d abA A2d True The database server treats any multibyte character as a literal character To tell the database server to interpret a wildcard character as its literal meaning you must precede the character with an escape character You must use single byte characters as escape characters the database server does not recognize use of multibyte characters for this purpose The default escape character is the backslash The following use of the MATCHES clause gives a true result for the column value that is shown Clause Quoted String Column Value Result MATCHES ab d ab d True SQL Features 3 33 Handling Character Data Handling Character Data The GLS feature allows you to put non ASCII characters including multibyte characters in the following parts of an SQL statement Quoted strings Comments Column substrings TRIM function arguments UPPER LOWER and INITCAP function strings Specifying Quoted Strings You use quoted strings in a variety of SQL statements particularly data manipulation statements such as SELECT and INSERT A quoted string is a
277. s data in such code sets it can assume that 1 byte stores 1 character The ASCII code set contains 128 characters Therefore the code point for each character requires 7 bits of a byte These single byte characters with code points in the range 0 to 128 are sometimes called ASCII or 7 bit characters The ASCII code set is a single byte code set and is a subset of all code sets that Informix products support 1 8 Informix Guide to GLS Functionality A GLS Locale If a code set contains more than 128 characters some of its characters have code points that must set the eighth bit of the byte These non ASCII characters might be either of the following types of characters m 8 bit characters The 8 bit characters are single byte characters whose code points are between 128 and 255 Examples from the ISO8859 1 or Microsoft 1252 code set include the non English and characters Only if the software is 8 bit clean can it interpret these characters correctly For more information on 8 bit characters and 8 bit clean software see the description of the GLS8BITFSYS environment variable on page 2 25 m Multibyte characters If a character set contains more than 256 characters the code set must contain multibyte characters A multibyte character might require from 2 to 4 bytes of storage Many Asian languages contain 3 000 to 8 000 ideographic characters Such languages have code sets made up of both single byte and multibyte charact
278. s not have to handle possible buffer size increases Your code processes the contents of sqlname in the client code set Informix Guide to GLS Functionality Using the TRIM Function Using the TRIM Function When you dynamically execute a SELECT statement the DESCRIBE statement can return information about the select list columns at runtime DESCRIBE returns the data type of a select list column into the appropriate field of the dynamic management structure that you use For more information see Determining the Data Type of a Column in the INFORMIX ESQL C Programmer s Manual When you use the DESCRIBE statement on a prepared SELECT statement with the TRIM function in its select list the data type of the trimmed column that DESCRIBE returns depends on the database server that you use and the data type of the column to be trimmed the source character value expression For more information on the source character value expression see the description of the TRIM function in the Informix Guide to SQL Syntax The TRIM function works differently with INFORMIX SE Except for INFORMIX SE the data type that the DESCRIBE statement returns depends on the data type of the source character value expression as follows m If the source character value expression is data type CHAR or VARCHAR DESCRIBE returns the data type of the trimmed column as SQLVCHAR m If the source character value expression is data type NCHAR or NVARC
279. sample strings consist of single byte characters Informix Guide to GLS Functionality The CHAR_LENGTH Function _ EE CHAR_LENGTH Argument Quoted string CHAR or NCHAR column VARCHAR or NVARCHAR column TEXT column Host or procedure variable Behavior Returns number of characters in string including any trailing white spaces as defined in the locale Returns number of characters in string including trailing white spaces This value is the defined length in bytes of the column Returns number of characters in string including white spaces This value is the actual length in bytes of the character string It is not the defined maximum column size Returns number of characters in column including trailing white spaces Returns number of characters that the variable contains including any trailing white spaces regardless of defined length of variable Example If the string is Ludwig the result is 6 If the string is Ludwigssss the result is 10 If the fname column of the customer table is a CHAR 15 column and this column contains the string Ludwig the result is 15 If the fname column contains the string Ludwigssss the result is 15 If the cat_advert column of the catalog table is a VARCHAR 255 65 and this column contains the string Ludwig the result is 6 If the column contains the string Ludwigssss the result is 10 If the cat_descr column in
280. ser of the database application understands This format depends on factors such as the language that the user speaks and the culture or territory in which the user resides The GLS locale is set of Informix files that bring together the information about data that is specific to a particular culture language or territory In particular a GLS locale provides the following information m The name of the code set that the application data uses m The collation order to use for character data m The format for different types of data to appear to end users This section describes each of these topics in more detail Tip For information about the format of these GLS files see Appendix A A Code Set A character set is one or more natural language alphabets together with additional symbols for digits punctuation and diacritical marks Each character set has at least one code set which maps its characters to unique bit patterns These bit patterns are called code points ASCII ISO8859 1 Microsoft 1252 and EBCDIC are examples of code sets that support the English language The number of unique characters in the language determines the amount of storage that each character requires in a code set Because a single byte can store values in the range 0 to 255 it can uniquely identify 256 characters Most Western languages have fewer than 256 characters and therefore have code sets made up of single byte characters When an application handle
281. server also uses the database locale when it creates a new database It stores a condensed version of the database locale in the systables catalog of the database Informix NLS databases before Version 7 2 also store the locale specific information in systables However the locale names are different from those in GLS databases For information on how GLS database servers convert NLS databases see the Informix Migration Guide Informix ALS databases store the locale specification information somewhat differently For information on how GLS database servers convert ALS databases see the Informix Migration Guide amp Informix Guide to GLS Functionality AD XP Locales in the Client Server Environment When the database server stores the database locale information directly in the system catalog it permanently attaches the locale to the database In this way the database server can always determine the locale that it needs to interpret the locale sensitive data correctly This information includes opera tions such as how to handle regular expressions compare character strings and ensure proper use of code sets The collation order determines the data type of system catalog tables m fa database locale is collated in code set order all its system catalog tables are created with the CHAR data type m fa database locale is collated in localized order all its system catalog tables are created with the NCHAR data type I
282. sets to use The client application uses the client code set which the CLIENT_LOCALE environment variable specifies to write all files on the client computer and to interact with all client I O devices The database server uses the server code set which the SERVER_LOCALE environment variable specifies to write files such as debug and warning files The database server uses the database code set which the DB_LOCALE environment variable specifies to transfer data to and from the database In a client server environment character data might need to be converted from one code set to another if the client or server computer uses different code sets to represent the same characters The conversion of character data from one code set the source code set to another the target code set is called code set conversion Without code set conversion one computer cannot correctly process or display character data that originates on the other when the two computers use different code sets Code set conversion does not provide either of the following capabilities Code set conversion is not a semantic translation It does not convert between words in different languages For example it does not convert from the English word yes to the French word oui It only ensures that each character retains its meaning when it is processed or printed regardless of how it is encoded Code set conversion does not create a character in the target cod
283. sion and serves as documentation for the corresponding object file The code set conversion object file is a compiled form of the code set conversion information Informix products use the object file to obtain code set conversion information quickly Object code set conversion files have a cvo file extension The header of the code set conversion source file cv lists the two code sets that it converts and the direction of the conversion Managing GLS Files A 15 Code Set Conversion Files A 16 Code Set Conversion Filenames To conform to DOS 8 3 naming conventions GLS code set conversion files use a condensed form of the code set names code1code2 in their filenames The 8 character name of each code set conversion file is derived from the hexadecimal representation of the code set numbers of the source code set code1 and the target code set code2 For example the ISO8859 1 code set has an IBM CCSID number of 819 in decimal and 0333 in hexadecimal The IBM CCSID 437 code set a common IBM UNIX code set has a hexadecimal value of 01b5 Therefore the 033301b5 cv code set conversion file describes the conversion from the CCSID 819 code set to the CCSID 437 code set Required for Code Set Conversion Informix products use the Informix Code Set Name Mapping file to translate between code set names and the more compact code set numbers You can use the registry file to find the hexadecimal values that correspond to code
284. size of individual characters Informix Guide to GLS Functionality INFORMIX GLS Compatibility Handle memory management for multibyte and wide character strings INFORMIX GLS functions assist in memory allocation of multibyte character strings and wide character strings These functions access the current processing locale and its code set to determine the size of individual characters Convert date time money and number strings to and from binary values INFORMIX GLS functions assist in the conversion of locale specific formats for date time monetary and numeric values to and from their internal formats in the database their binary values These functions access information in the current processing locale to interpret the locale specific formats Process input and output multibyte character streams INFORMIX GLS functions call user defined functions to obtain the bytes of a multibyte character from and put these bytes in a character stream Informix client applications as well as database servers can access INFORMIX GLS For applications you link the INFORMIX GLS library to your application to perform locale related tasks Informix database servers automatically include the INFORMIX GLS library INFORMIX GLS Compatibility This section provides information about INFORMIX GLS compatibility Informix Products The INFORMIX GLS library is compatible with most Informix products The database server and the application m
285. slash identifies the date separator However the Informix product ignores the date separator when it scans a date string Therefore you can use any character as a date separator during the scan operation GLS Environment Variables 2 15 DBLANG DBLANG For an Informix product to print a date string that contains an era based date it expects DBDATE to indicate the era based format of the value to print With DBDATE set as in the previous example an Informix product uses this end user format to convert an internal DATE value to an era based date string as follows mE tells the Informix product to print the multibyte character that represents the era name m Y2 tells the Informix product to print a 2 digit year offset for the era m D tells the Informix product to print the numeric value that repre sents the day m Mtells the Informix product to print the numeric value that repre sents the month m The slash identifies the date separator that the Informix product prints between each portion of the date This character must be one of the valid date separators during the print operation Tip The DBDATE environment variable supports only the slash period and minus sign as date separators To specify some other character including non ASCII characters as a date separator use the GL_DATE environment variable For more information on the scan and print operations see End User Formats on page 1
286. stallation The os subdirectory contains a subdirectory for each operating system locale that the platform of your Informix product supports The GLS operating system locales are in subdirectories of the INFORMIXDIR gls lcX os directory for UNIX and in subdirectories of the INFORMIXDIR gls IlcX os directory for Windows NT Informix provides these operating system GLS locale files for backward compatibility with Informix NLS products For more information see the Informix Migration Guide e Locale Source and Object Files Each locale file has the following two forms m Alocale source file is an ASCII file that defines the locale categories for the locale This file has the Ic file extension and serves as documentation for the corresponding object file m A locale object file is a compiled form of the locale information Informix products use the object file to obtain locale information quickly Locale object files have the lco file extension Managing GLS Files A 11 Location of Locale Files The header of the locale source file Ic lists the language territory code set and any optional locale modifier of the associated locale A section of the locale source file supports each of the locale categories as Figure A 1 shows Figure A 1 Locale Categories in a Locale Source File Locale Category Locale File Category Reference CTYPE LC_CTYPE page A 6 COLLATE LC_COLLATE page A 6 NUMERIC LC_NUMERIC page A 7 MONETARY LC_MON
287. t Functions That Date Function Date Routine Support Era Based Extensions rdatestr ECO DAT rstrdate ECO STR rdefmtdate ECO DEF rfmtdate ECO FMT This section describes locale specific behavior of the ESQL DATE format functions For general information on the syntax and use of the ESQL C DATE format functions see the INFORMIX ESQL C Programmer s Manual For general information on the syntax and use of ESQL COBOL DATE format routines see the INFORMIX ESQL COBOL Programmer s Manual GL_DATE Support The value of the GL_DATE environment variables can affect the results that these ESQL DATE format functions generate The end user format that GL_DATE specifies overrides date end user formats that the client locale defines For more information see Precedence for Date End User Formats on page 5 14 Informix Guide to GLS Functionality DATE Format Functions DBDATE Extensions Figure 5 2 shows the ESQL DATE format functions that support the extended era based date syntax for the DBDATE environment variable For more information of the era based date extensions see the description of DBDATE on page 2 9 Figure 5 2 ESQL C ESQL COBOL ESQL DATE Format Functions That Date Function Date Routine Support DBDATE Extensions rdatestr ECO DAT rstrdate ECO STR When you set DBDATE to one of the era based formats these functions use era based dates to convert between date strings and internal DATE values The following ES
288. ta can consist of letters numbers and symbols The following list summarizes how choice of a locale affects the CHAR data type m The size of a CHAR column is byte based not character based For example if you define a CHAR column as CHAR 10 the column has a fixed length of 10 bytes not 10 characters If you want to store multibyte characters in a CHAR column keep in mind that the total number of characters you can store in the column might be less than the total number of bytes you can store in the column Make sure to define the byte size of the CHAR column so that it can hold enough characters for your purposes m You can enter single byte or multibyte characters ina CHAR column The database locale must support the characters that you want to store in CHAR columns m The database server sorts CHAR columns in code set order not in localized order For more information on collation order see The Collation Order on page 1 10 m Within a client application always manipulate CHAR data in the CLIENT_LOCALE of the client application The client application performs code set conversion of CHAR data automatically if CLIENT_LOCALE differs from DB_LOCALE For information on code set conversion see page 1 40 For the syntax of the CHAR data type see the Informix Guide to SQL Syntax For a detailed explanation of the CHAR data type see the Informix Guide to SQL Reference Informix Guide to GLS Functionality Other
289. tabase server does not allow the client to con nect to a database if the database locale that the client sends does not match the database locale of the NLS database that the client requested Determining the Server Processing Locale The database server uses the server processing locale to obtain locale infor mation for its own internal sessions and for any connections When the database server begins execution it initializes the server processing locale to the default locale When a client application requests a connection the database server must redetermine the server processing locale to include the client and database locales The database server uses the server processing locale to obtain locale information that it needs when it transfers data between the client and database Informix Guide to GLS Functionality Establishing a Database Connection Once the Informix database server verifies the database locale see page 1 33 it uses a precedence of environment variables from the client and database locales to set the server processing locale Figure 1 3 shows the relationship between the client locale database locale server locale and server processing locale Figure 1 3 The Server Processing Locale Client computer Server computer fa Log file a Message log file Server locale Client application Database server Informix Ta Client l
290. ted for backward compatibility A date or time end user format string specifies a format for the manipulation of internal DATE or DATETIME values as a literal string For more infor mation see End User Formats on page 1 12 Tip When you set these environment variables you do not affect the internal format of the DATE and DATETIME values within a database The GL_DATE and GL_DATETIME environment variables support formatting directives that allow you to specify an end user format A formatting directive has the form x where x is one or more conversion characters For the complete syntax of the GL_LDATE and GL_DATETIME environment variables see the entries for these environment variables in GLS Related Environment Variables on page 2 4 1 50 Informix Guide to GLS Functionality NLS Customizing Date and Time End User Formats Era Based Date and Time Formats The GL_DATE and GL_DATETIME environment variables provide support for alternative dates and times such as era based Asian formats These alter native formats support dates such as the Taiwanese Ming Guo year and the Japanese Imperial era dates For more information about these era based date formats see Date and Time Formats on page 1 15 Tip The DBDATE and DBTIME environment variables also provide some support for era based dates See the entries for these environment variables in Chapter 2 GLS Environment Variables To specify era based f
291. ter Machine notes are named for the product described Replace x y in the filename with the version number of your database server to derive the name of the machine notes file The following items appear in the Informix folder To display this folder choose Start gt Programs gt Informix from the Task Bar Item Description Documentation Notes This item includes additions or corrections to manuals along with information about features that may not be covered in the manuals or that have been modified since publication Release Notes This item describes feature differences from earlier versions of Informix products and how these differ ences might affect current products This file also contains information about any known problems and their workarounds Machine notes do not apply to Windows NT platforms Introduction 19 Related Reading Related Reading For additional information about cultural and linguistic requirements around the world and how computer systems handle those requirements consult the following books on internationalization m Developing and Localizing International Software by Tom Madell Clark Parsons and John Abegg Prentice Hall Inc 1994 m Programming for the World A Guide to Internationalization by Sandra Martin O Donnell Prentice Hall Inc 1994 For a list of publications that provide an introduction to database servers and operating system platforms refer to your Getting Started ma
292. ternal represen tation on the client computer to its internal representation on the server computer where it is stored as follows m When aclient application sends an opaque type in its internal repre sentation to the database server the database server invokes the receive support function to convert the data from the client internal representation to the server internal representation m When a client application receives an opaque type in its internal format from the database server the database server invokes the send support function to convert the data from the server internal repre sentation to the client representation If the internal representation of an opaque type contains a string money date or time type the client application cannot perform any locale trans lation because the opaque data type is encapsulated Therefore the send and receive functions must perform the translation You can use the following DataBlade API functions to help with these translations mi_get_string mi_put_string mi_get_money mi_put_money mi_get_date mi_put_date mi_get_datetime mi_put_datetime For more information on these DataBlade API functions see the DataBlade API Programmer s Manual Database Server Features 4 25 Distinct Data Types Distinct Data Types A distinct data type has the same internal storage representation as its source type but has a different name Its source type can be an existing opaque
293. th such a connection it is your responsibility to understand the format of the data that is being exchanged For example suppose that your client application uses CLIENT_LOCALE set to en_us 1252 and DB_LOCALE set to en_us 8859 1 and then opens a database with the French fr_fr 8859 1 locale The database server sets SQLWARN7 because the languages and territories of the two locales are different The database server then uses the locale of the database fr_fr 8859 1 for the localized order of the data GLS Fundamentals 1 33 Establishing a Database Connection NLS 1 34 However your application might choose to use this connection It might be acceptable for the application to receive the NCHAR and NVARCHAR data that is sorted in a French localized order Any code set conversion that the client application performs would still be valid because both database locales support the ISO8859 1 code set For more information on code set conversion see page 1 40 Instead if the application opens a database with the Japanese SJIS ja_jp sjis locale the database server sets the SQLWARN7 flag because the language territory and code sets differ The database server then uses the ja_jp sjis locale for the localized order of the data Your application would probably not continue with this connection Because the code sets are different the client application would not perform code set conversion correctly If DBNLS is set to one 1 the da
294. that is sufficiently large for the data when it is in the client code set For example the following code fragment allocates an sqldata buffer with the malloc system call EXEC SQL include sqlda struct sqlda q_desc EXEC SQL describe sqlstmt_id into q_desc q_desc gt sqlvarL0 sqidata char malloc q_desc gt sqlvar 0 sqllen INFORMIX ESQL C Features 6 15 Using the DESCRIBE Statement 6 16 In the preceding code fragment the client application might truncate characters that it converts because the client application uses the sqllen value to determine the buffer size Instead increase the buffer to four times its original size when you allocate a buffer as the following code fragment shows EXEC SQL include sqlda EXEC SQL define BUFSIZE_FACT 4 struct sqlda q_desc q_desc gt sqlvarL0 sqllen q_desc gt sqlvar O0 sqllen BUFSIZE_FACT 1 q_desc gt sqlvar 0 sqldata char malloc q_desc gt sqlvarL0 sqllen Informix suggests a buffer size factor BUFSIZE_FACT of 4 because a multibyte character has a maximum size of 4 bytes The sqiname Field The sqIname field contains the name of the column When the client appli cation performs code set conversion this column name might also undergo expansion when the application converts it from the database code set to the client code set Because the ESQL C application stores the buffer for sqlname data in its internal work area your ESQL C source code doe
295. tifier Column name SQL Segment Expression Notes An example of an SQL statement that creates a column name is CREATE TABLE Connection Quoted string An example of an SQL statement that creates a name connection name is CONNECT For more information see Specifying Quoted Strings on page 3 34 Constraint Constraint An example of an SQL statement that creates a name name constraint name is CREATE TABLE Cursor name Identifier An example of an SQL statement that creates a cursor name is DECLARE For more information see Using Non ASCII Characters in Source Code on page 5 6 1 of 3 SQL Features 3 5 Identifiers That Support Non ASCII Characters AD XP 3 6 SQL Identifier Filename Host variable name Index name Role name Statement identifier Informix Guide to GLS Functionality SQL Segment Database name Database name None None Index name Identifier Identifier Notes An example of an SQL statement that creates a database name is CREATE DATABASE Restrictions apply when you use multibyte characters for database names in SE For more information see Generating Non ASCII Filenames on page 4 9 An example of an SQL statement that specifies a pathname and filename is LOAD The syntax for pathnames and filenames including log files depends on the operating system If you use multibyte characters in pathnames you limit portability of the files to those
296. ting system file that it generates When you set GLS8BITFSYS to 0 Informix products generate filenames with 7 bit ASCII characters only You can set GLS8BITFSYS with other Informix database servers but only the INFORMIX SE database server and certain utilities and compilers check the value Restrictions on Non ASCII Filenames If your locale supports a code set with non ASCII characters restrictions apply to filenames for operating system files that Informix products generate Before you or an Informix product creates a file and assigns a filename consider the following questions m Does your operating system support non ASCII filenames m Does the Informix product accept non ASCII filenames GLS Environment Variables 2 25 GLS8BITFSYS Making Sure That Your Operating System Is 8 Bit Clean To support non ASCII characters in filenames your operating system must be 8 bit clean An operating system is 8 bit clean if it reads the eighth bit as part of the code value In other words the operating system must not ignore or make its own interpretation on the value of the eighth bit Informix recommends that you consult your operating system manual or system administrator to determine whether your operating system is 8 bit clean before you decide to use a nondefault locale that contains non ASCII characters in filenames that Informix products use and generate Setting the GLS8BITFSYS Environment Variable Use the GLS8BITFSYS envi
297. tion Dollar sign Currency symbol Comma Thousands separator Period Decimal separator Regardless of the client locale that you use you must use the preceding ASCII symbols in the format string to identify where to place the currency symbol decimal separator and thousands separator The numeric format function uses the following precedence to translate these symbols to their locale specific equivalents 1 The symbols that DBMONEY indicates if DBMONEY is set For locale specific behavior of DBMONEY see DBMONEY Exten sions on page 5 23 The symbols that the appropriate locale category of the client locale if CLIENT_LOCALE is set specifies If the format string contains either a or formatting character a numeric format function assumes that the value is a monetary value and refers to the MONETARY category of the client locale If these two symbols are not in the format string a numeric format function refers to the NUMERIC category of the client locale For more information on the use of the and formatting characters see Currency Symbol Formatting on page 5 21 For more information on the MONETARY and NUMERIC locale categories see Locale Categories on page A 4 The actual symbol that appears in the format string comma or period General SQL API Features 5 19 Numeric Format Functions 5 20 In other words these numeric format functions replace the dollar sign in the form
298. tion than it did before You must ensure that the buffer you pass to these ESQL shift functions is large enough to accommodate this expansion GLS Specific Error Messages The following ESQL functions might generate GLS specific error messages m DATE format functions see Figure 5 1 on page 5 8 m DATETIME format functions see Figure 5 8 on page 5 15 m Numeric format functions see Figure 5 9 on page 5 17 For more information on GLS specific error messages refer to the Informix Error Messages manual Establishing a Database Connection To connect to a database an ESQL client application requests a connection from the database server The database server must verify that it can access the database and establish the connection between the client and the database Your client application performs the following tasks m Sends its client and database locale information to the database server The ESQL program performs this step automatically when it requests a connection m Checks for connection warnings that the database server generates You must provide code in your ESQL program to perform this step 5 24 Informix Guide to GLS Functionality Sending Client Locale Information Sending Client Locale Information When an ESQL client program requests a connection to a database it sends its client locale information to the database server The database server uses this information to determine the following information m H
299. to SQL Reference Imagine that the subdiagram is spliced into the main diagram at this point A shaded option is the default action Syntax within a pair of arrows indicates a subdiagram The vertical line terminates the command t OFF G ON A branch below the main path indicates an optional path Any term on the main path is required unless a branch can circumvent it Core variable A loop indicates a path that you can repeat Punctuation along the top of the loop indicates the separator symbol for list items TE A gate B ona path indicates that you can only use that path the indicated number of times even if it is part of a larger loop Here you can specify size no more than three times within this statement segment 2 of 2 Introduction 11 Command Line Conventions How to Read a Command Line Diagram Figure 1 shows a command line diagram that uses some of the elements that are listed in the previous table Figure 1 Example of a Command Line Diagram setenv INFORMIXC n compiler J pathname To construct a command correctly start at the top left with the command setenv Then follow the diagram to the right including the elements that you want The elements in the diagram are case sensitive Windows NT uses a different syntax to set environment variables It does not use the setenv command Many Informix products on Windows NT use the SETNET32 graphical tool t
300. to the database server Q DBNLS and LC_ The client application sends the LC_ environment variables only if DBNLS is set If DBNLS is set but the LC_ variables are not the client sets the appropriate LC_ values based on the LANG environment variable and sends these LC_ values to the database server The client application does not send the value of the LANG environment variable to the database server Q DBCODESET A Version 5 x ALS client application can send DBCODESET to a Version 7 2 or later database server the database server converts the DBCODESET value to a valid locale name and uses it as DB_LOCALE A Version 6 x ALS client application sends the CLIENT_LOCALE and DB_LOCALE environment variables m User customized end user formats a Date and time end user formats GL_DATE and GL_DATETIME or DBDATE and DBTIME a Monetary end user formats DBMONEY If you do not set any of these environment variables the client appli cation does not send them to the database server and the database server uses the end user formats that the client locale defines The database server uses this information to verify the database locale and to establish the server processing locale Informix Guide to GLS Functionality Establishing a Database Connection Verifying the Database Locale To open an existing database the client application must correctly identify the database locale for the databases that it needs to access
301. tor and decimal separator For more information on currency notation see Numeric and Monetary Formats on page 1 14 For the default locale the currency symbol is a dollar sign the thousands separator is a comma and the decimal separator is a period For nonde fault locales the locale defines the appropriate culture specific currency notation for monetary values You can also use the DBMONEY environment variable to customize the currency symbol and decimal separator for monetary values For more information see Customizing Monetary Values on page 1 53 Using Data Manipulation Statements The choice of a locale can affect the following SQL data manipulation statements DELETE INSERT LOAD UNLOAD UPDATE E E The following sections describe the GLS aspects of these SQL statements For a complete description of the use and syntax of these statements see the Informix Guide to SQL Syntax Informix Guide to GLS Functionality Specifying Conditions in the WHERE Clause Specifying Conditions in the WHERE Clause The following SQL statements might include a WHERE clause to tell the database server on which rows to operate For the DELETE statement the WHERE clause specifies which rows to delete For the INSERT statement if the statement includes an embedded SELECT the WHERE clause specifies which rows to insert from another table For the UPDATE statement the WHERE clause specifies wh
302. tro 8 platform Intro 8 product Intro 8 Identifier 3 10 4 7 See also Delimited identifiers SQL identifier idx file extension 4 4 iem file extension 2 18 If 3 14 IN conditions 3 28 Index 3 6 4 9 Indicator variable 1 7 5 6 6 5 Industry standards compliance with Intro 20 7 6 Informix Code Set Name Mapping file See registry file Informix code set conversion file See Code set conversion file 8 Informix Guide to GLS Functionality Informix Dynamic Server chunk name 4 9 code set conversion 1 44 diagnostic files 4 3 high performance loader 4 19 identifiers 4 7 log filename 4 9 message log file 4 3 multibyte characters 4 14 multibyte characters in identifiers 4 7 multibyte filenames 4 9 non ASCII filenames 4 9 operating system files 4 3 pathnames 4 9 sample connection 1 22 uses of server locale 4 3 utilities 4 14 See also Database server Informix Dynamic Server with UD option See Database server INFORMIXDIR environment variable location of charmap files A 26 location of code set files A 18 A 26 location of code set conversion files A 15 A 25 location of locale files 1 21 A 9 A 22 location of message files 2 16 2 17 location of operating system locales A 11 location of registry file A 19 with glfiles A 22 INFORMIX GLS compatibility with Informix products 7 5 current processing locale 7 4 features 7 4 how to use 7 4 industry conformance 7 6 introduced 7 3 location of locale information 7 4 INFORMIX SE
303. ts Om Is replaced by the month in the alternative digits that the locale defines same as m if locale does not define alternative digits Ow Is replaced by the weekday as a single digit number 0 through 6 in the alternative digits that the locale defines same as Yow if locale does not define alternative digits The equivalent of zero 0 represents the locale equivalent of Sunday Oy Is replaced by the year as a 2 digit number 00 through 99 in the alternative digits that the locale defines same as y if locale does not define alternative digits For information about how to format a year value see the description of y YOY Is the same as EY same as Y if locale does not define alternative digits Informix Guide to GLS Functionality GL_DATE The TIME category of the locale defines the following era information m The full and abbreviated names for an era m A special date representation for the era which the Ex formatting directive uses The NUMERIC category of the locale defines the alternative digits for a locale which the Ox formatting directives use For more information on the TIME and NUMERIC categories of a locale see page A 4 For a description of the era based formats for DATETIME values see Alter native Time Formats on page 2 39 Optional Date Format Qualifiers You can specify the following optional format qualifiers immediately after the symbol of the formatting directive A
304. types of data in more detail Numeric and Monetary Formats Numeric data is data from columns with the following data types DECIMAL INTEGER SMALLINT FLOAT and SMALLFLOAT Monetary data is data from a MONEY column When an Informix product scans a string that contains monetary data it uses the monetary end user format to determine how to convert this string to the internal integer value for a MONEY column When an Informix product prints a string that contains monetary data it uses the monetary end user format to determine how to format the internal integer value for a MONEY column as a string In the same way Informix products use the numeric end user format to scan and print strings for the internal values of the numeric data types Important The end user formats of the numeric and monetary data do not affect the internal format of the numeric or MONEY data types in the database They affect only how the client application views the data The end user formats for numeric and monetary data specify the following characters and symbols m The decimal separator symbol often called the radix character that separates the integral part of the numeric value from the fractional part In the default locale the period is the decimal separator 3 01 In a French or other European locale the comma is the decimal separator 3 01 1 14 Informix Guide to GLS Functionality AGLS Locale m The thousands separator symbol that appears bet
305. uage English Territory United States Modifier dict Code Set 8859 1 Locale Name en_us 8859 1 Filename lcll en_us 0352 1co Language English Territory United States Code Set PC Latin 1 Locale Name en_us PC Latin 1 Filename lcll en_us 04e4 1co Language English Territory United States Code Set CP1252 Locale Name en_us CP1252 Figure A 2 Sample glfiles File for GLS Locales Managing GLS Files A 23 Listing GLS Locale Files A 24 NLS The IcX txt file also contains GLS locales that are compatible with many operating system locales Figure A 3 shows the format in 1c11 txt for these GLS operating system locales For more information see Locale File Subdi rectories on page A 10 Figure A 3 KKEKKKKKKKKKKKKKKKK KKK KKK KK KKK KK KKK KKK KKKKKKKKKKKKKEKKK Format for Operating System The following locales are provided to ensure that p goa E e E E E a kkkkkxkxkxkxkxkxkkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkkxkkxkkkxkkxkkkkkkkkkkkkxk an e a Informix servers starting with version 7 20 can open databases created by version 6 xx and 7 1x Informix servers Because these locales are based on operating system locales and operating system locales do not provide the required information no Language territory Modifier or Code Set names are provided below FF FF HF HF HF os de de os en_US en_US os es es os fr Er
306. umber of bytes in string including trailing white spaces This value is the actual length in bytes of the character string It is not the defined maximum column size Returns number of bytes in column including trailing white spaces Returns number of bytes that the variable contains including any trailing white spaces regardless of defined length of variable If the string is Ludwig the result is 6 If the string is Ludwigssss the result is 10 If the fname column of the customer table is a CHAR 15 column and this column contains the string Ludwig the result is 15 If the fname column contains the string Ludwigsss the result is still 15 If the cat_advert column of the catalog table is a VARCHAR 255 65 column and this column contains the string Ludwig the result is 6 If the column contains the string Ludwigssss the result is 10 If the cat_descr column in the catalog table is a TEXT column and this column contains the string Ludwig the result is 6 If the cat_descr column contains the string Ludwigssss the result is 10 If the procedure variable f_name is defined as CHAR 15 and this variable contains the string Ludwig the result is 6 If the f_name variable contains the string Ludwigssss the result is 10 SQL Features 3 45 The CHAR_LENGTH Function 3 46 The difference between the LENGTH and OCTET_LENGTH functions is that OCTET_LENGTH generally includes tra
307. umes that coll is a CHAR column and col2 is an NCHAR column in table mytable Query Data Type Query Results SELECT FROM mytable CHAR All rows in which column coll contains WHERE coll MATCHES art the value art with a lowercase a SELECT FROM mytable NCHAR All rows in which column col2 contains WHERE col2 MATCHES art the value art or Art When you use the MATCHES keyword to specify a range collation consider ations come into play for all columns with character data types When the column to the left of the MATCHES keyword is an NCHAR NVARCHAR CHAR or VARCHAR column and the quoted string to the right of the MATCHES keyword includes brackets to specify a range the database server uses localized order Important When the database server determines the characters that fall within a range it always uses the localized order that is specified for the database even for CHAR and VARCHAR columns This behavior is an exception to the rule that the database server uses code set order for all operations on CHAR and VARCHAR columns and uses localized order for all operations on NCHAR and NVARCHAR columns Some simple examples show how the database server treats NCHAR NVARCHAR CHAR and VARCHAR columns when you use the MATCHES keyword with a range in a SELECT statement Suppose that you want to retrieve from the abonn s table the employee number first name and last name for all employees whose last name nom begins in the range o
308. unction The LENGTH function returns the number of bytes of data in character data However the behavior of the LENGTH function varies with the type of argument that the user specifies The argument can be a quoted string a character type column other than the TEXT data type a TEXT column a host variable or a stored procedure variable The following table shows how the LENGTH function operates on each of these argument types The Example column in this table uses the symbol s to represent a single byte trailing white space This table also assumes that the sample strings consist of single byte characters Behavior Example Quoted string CHAR VARCHAR NCHAR or NVARCHAR column TEXT column Host or procedure variable 3 42 Returns number of bytes in string minus any trailing white spaces as defined in the locale Returns number of bytes in a column minus any trailing white spaces regardless of defined length of the column Returns number of bytes in a column including trailing white spaces Returns number of bytes that the variable contains minus any trailing white spaces regardless of defined length of the variable Informix Guide to GLS Functionality If the string is Ludwig the result is 6 If the string is Ludwigssss the result is still 6 If the fname column of the customer table is a CHAR 15 column and this column contains the string Ludwig the result is 6 If the fname column
309. ur current directory m Table and index dat and idx files When you create a table in a database SE creates two files a data file dat and an index file idx SE stores the data and index files that are associated with a database in the dbname dbs subdirectory m Log file SE creates this file when you specify the WITH LOG IN clause of the CREATE DATABASE statement Tip For information about diagnostic database table index and message log files as well as configuration parameters see your Administrator s Guide For informa tion about the dbexport utility see the Informix Migration Guide These operating system files reside on the server computer the same computer on which the database server resides When the database server reads from or writes to these files it must use a code set that the server computer supports The database server obtains this code set from the server locale Set the server locale with the SERVER_LOCALE environment variable If you do not set SERVER_LOCALE the database server uses the default locale U S English as the server locale For the definition of server locale see page 1 27 For information on how to set SERVER_LOCALE see page 2 43 All coservers should have identical GLS operating system environments 4 4 Informix Guide to GLS Functionality AD XP AD XP Performing Code Set Conversion The database server needs to determine the code set that the server
310. urce A 11 A 20 Locale modifier 1 20 1 21 1 33 A 12 Locale name assigning 1 29 code set name 1 20 1 21 1 30 1 33 description of 1 20 language name 1 20 1 33 A 10 locale modifier name 1 20 1 21 1 33 A 12 sample 1 21 syntax 1 20 territory name 1 20 1 33 A 10 Localized collation order See Collation order localized Locator structure 6 13 loc_buffer field 6 14 loc_t data type 6 12 6 13 loc_type field 6 13 Log file 1 27 4 3 4 4 Log filename non ASCII characters in 4 9 Lossy error 1 42 LOWER function 3 41 LVARCHAR data type code set conversion 4 6 M Machine notes Intro 19 MATCHES relational operator 1 10 3 29 Message file compiled 2 18 error messages Intro 18 language specific 2 16 localized 1 49 locating at runtime 2 17 sample 1 28 specifying location of 1 49 2 16 Message log sample 1 44 MESSAGES locale category description of A 4 A 9 in default locale A 5 in locale source file A 12 in server processing locale 1 40 Microsoft 1252 code set 1 19 1 21 Migrating from GLS databases 4 19 to or from GLS databases 4 14 4 18 Ming Guo year format 1 16 1 51 2 14 Modifier See Locale modifier Monetary data currency notation 1 14 3 50 A 7 currency symbol 1 15 1 20 3 50 5 19 A 7 decimal separator 1 14 1 19 3 50 5 19 A 7 default scale 3 49 Index 9 end user format 1 14 1 19 1 39 1 53 A 8 format of A 7 locale specific 1 6 negative 1 15 1 19 A 7 positive 1 15 1 19 A 7
311. ussed For detailed directions on using SQL statements for a particular application development tool or SQL API see the manual for your product Character Representation Conventions Throughout this manual examples show how single byte and multibyte characters appear Because multibyte characters are usually ideographic such as Japanese or Chinese characters this manual does not use the actual multibyte characters Instead it uses ASCII characters to represent both single byte and multibyte characters This section provides general infor mation about how this manual represents multibyte and single byte characters abstractly For a definition of multibyte and single byte characters see the Glossary Introduction 13 Character Representation Conventions 14 Single Byte Characters This manual represents single byte characters as a series of lowercase letters The format for representing one single byte character abstractly is a LA In this format a stands for any single byte character not for the letter a itself The format for representing a string of single byte characters is as follows a Z In this format a stands for the first character in the string and z stands for the last character in the string For example if the string Ludwig consists of single byte characters the following format represents this 6 character string abstractly abcdef a Tip The letter s does not appear
312. ust both support INFORMIX GLS in order for you to use INFORMIX GLS for internationalization INFORMIX GLS Features 7 5 Industry Conformance X O The following Informix application products can use INFORMIX GLS to handle internationalization Version 9 13 of INFORMIX ESQL C For more information on how to write ESQL C applications see the INFORMIX ESQL C Programmer s Manual The Informix DataBlade API for development of both client LIBMI applications and user defined routines UDRs Both kinds of DataBlade programs use DataBlade API functions to obtain locale information from a database server For more infor mation on how to use the DataBlade API see the DataBlade API Programmer s Manual An ESQL C client application or a client LIBMI application that uses INFORMIX GLS can obtain locale information from an Informix database server that supports GLS functionality Informix Dynamic Server Version 7 3 Informix Dynamic Server with Advanced Decision Support and Extended Parallel Options Version 8 2 and later Informix Dynamic Server with Universal Data Option Version 9 1x INFORMIX OnLine Dynamic Server Version 7 2x INFORMIX OnLine Workgroup Server Version 7 2x INFORMIX SE Version 7 2x A DataBlade server routine can use INFORMIX GLS to obtain locale infor mation from Dynamic Server with UD Option Industry Conformance INFORMIX GLS was derived from the X Open XPG4 specifications Therefore it conforms to th
313. ut the default code set see The Default Locale on page 1 18 cust_name length cust_num Ludwig 6 101 Carole 6 102 Philip 6 103 Anthony 7 104 Raymond 7 105 With Multibyte Code Sets When you use the LENGTH function in a locale that supports a multibyte code set such as the Japanese SJIS code set the distinction between characters and bytes is meaningful The LENGTH function returns the number of bytes in the column or quoted string and this result might be quite different from the number of characters in the string SQL Features 3 43 The OCTET LENGTH Function 3 44 The following example assumes that the database that contains the customer_multi table has a database locale that supports a multibyte code set Suppose that the user enters a SELECT statement with the LENGTH function to display the last name the length of the last name and the customer number for the customer whose customer number is 199 SELECT Iname AS cust_name length fname AS length customer_num AS cust_num FROM customer_multi WHERE customer_num 199 Assume that the last name Iname for customer 199 consists of four characters represented as follows abl A bB BA In this representation the first character the symbol a is a single byte character The second character the symbol AtA is a 2 byte character The third character the symbol b is a single byte character The fourth character the symbol 8 B is a 2 byte character
314. uter if DBNLS is set on the client DBCODESET environment variable that the client application passes DBCODESET environment variable on the server computer if DBCODESET is not set on the client computer The default locale U S English Informix Version 9 1 or later database servers use the precedence of steps 1 3 and 8 in the preceding list to obtain the database information for the server processing locale You are not required to set the other environment variables Support for LANG and the LC_ environment variables provides backward compatibility for client applications that are based on Informix NLS products These applications use the precedence of steps 2 4 5 and 8 in the preceding list You are not required to set CLIENT_LOCALE for NLS based applications However CLIENT_LOCALE does provide certain advantages to your appli cation For more information see the Informix Migration Guide GLS Fundamentals 1 37 Establishing a Database Connection ALS 1 38 Support for the DBCODESET environment variable provides backward com patibility for client applications that are based on Informix Version 5 x ALS products These applications use the precedence of steps 1 3 6 7 and 8 in the preceding list For more information about how to run ALS based applica tions see the Informix Migration Guide e Tip The precedence rules apply to how the database server determines both the COLLATION category and the CTYPE cate
315. ver connection client locale information 1 32 establishing 1 31 5 24 naming 3 5 sample 1 23 1 24 1 27 1 28 1 44 server processing locale 2 8 verifying 1 31 1 33 1 38 5 24 warnings 1 33 5 25 Date data alternative formats 2 31 Asian See Era based dates customizing format of 1 50 end user format 1 15 1 19 1 39 1 50 A 9 format of A 8 locale specific 1 6 1 14 precedence of environment variables 1 51 5 14 setting GL_DATE 2 27 See also Data DATE data type DATETIME data type Era based dates DATE data type end user format 1 15 1 19 1 50 2 9 2 27 A 9 era based dates 1 51 ESQL library functions 5 8 ESQL C functions 5 8 5 10 ESQL C library functions 5 9 ESQL COBOL library routines 5 9 ESQL COBOL routines 5 8 5 10 extended format strings 5 10 internal format 1 12 1 15 precedence of environment variables 1 51 5 14 See also Date data DATETIME data type end user format 1 15 1 19 1 50 2 22 2 37 A 9 era based dates 1 51 ESQL library functions 5 15 ESQL C functions 5 15 ESQL COBOL routines 5 15 extended format strings 5 16 formatting directives for 2 38 internal format 1 15 precedence of environment variables 1 52 5 17 See also Date data DB code set See Database code set DB Access utility 1 6 4 18 DBAPICODE environment variable 1 45 DBCENTURY environment variable 2 31 DBCODESET environment variable 1 32 1 37 1 39 DBDATE environment variable era based dates 1 51 2 10 3 52 E
316. ver uses the SERVER_LOCALE environment variable for the following purposes m When the Informix database server writes its operating system files it uses the server code set which SERVER_LOCALE specifies For a list of operating system files for your database server see Using the Server Locale on page 4 3 m When a database server looks for product specific message files it looks in the message directory that is associated with the name of the server locale SERVER_LOCALE For more information see Locating Message Files on page 1 49 m On operating systems that are 8 bit clean the INFORMIX SE database server stores the names of database objects such as the database name and table names in the code set that SERVER_LOCALE specifies On operating systems that are not 8 bit clean SE can convert any non ASCII characters in these names to ASCII characters Set the GLS8BITFSYS environment variable to indicate whether the operating system is 8 bit clean For more information see Using the Server Locale on page 4 3 Tip If you do not set SERVER_LOCALE Informix database servers use the default locale U S English as the server locale GLS Environment Variables 2 43 SQL Features Naming Database Objects Rules for Identifier Names Identifiers That Support Non ASCII Characters References to SOL Segments a Owner Name in SQL Identifiers Valid Characters in Identifier Names Non ASCII Charact
317. vironment locale See Locale GLS feature available locales 1 21 1 29 CHAR data type 3 18 character data types for host variables 6 6 client server environment 1 18 1 22 description of 1 3 environment variables 2 4 ESQL library functions 5 7 for DataBlade 7 4 for ESQL C SQL API 5 3 6 3 7 3 for ESQL COBOL SQL API 5 3 for Gateways 1 45 for Informix Dynamic Server 4 3 for SQL 3 3 functionality listed 1 5 fundamentals 1 3 GLS files A 9 A 15 A 18 A 19 GLS library 1 4 locales 1 8 managing GLS files A 1 NCHAR data type 3 12 NVARCHAR data type 3 14 TEXT data type 3 20 using character data types 3 12 VARCHAR data type 3 19 GLS locale See Locale GLS8BITFSYS environment variable for ESQL filenames 5 5 for SE filenames 4 12 syntax 2 25 GL_DATE environment variable era based dates 1 51 3 52 ESQL library functions 5 8 precedence of 1 24 1 39 1 51 5 14 sending to database server 1 32 setting 1 50 syntax 2 27 Index 7 GL_DATETIME environment variable era based dates 3 52 era based dates and times 1 51 ESQL library functions 5 15 precedence of 1 24 1 39 1 52 5 17 sending to database server 1 32 setting 1 50 syntax 2 37 GL_PATH environment variable 1 45 H Host variable end user formats 1 12 ESQL C example 5 6 6 4 naming 1 7 3 6 5 6 6 4 IBM CCSID code set 437 1 43 A 16 819 A 13 A 16 A 19 definition of 1 43 Icons comment Intro 7 compliance Intro 9 feature In
318. vironment variable that specifies the directory in which you install the Informix product gls is the subdirectory that contains the GLS files and Z represents the version number for the code set object file format Each code set file has the following two forms m Thecode set source file is an ASCII file that describes the characters of a character set This file has a cm extension and serves as documentation for the corresponding object file m The code set object file is a compiled form of the code set information The object file is used to create locale object files Object code set files have a cmo file extension Figure A 5 on page A 26 shows the output that the glfiles utility generates for charmap files The Informix registry File The Informix Code Set Name Mapping file which is called registry is an ASCII file that associates code set names and aliases with their code set numbers A code set number is based on the IBM CCSID numbering scheme Informix products use code set numbers to determine the filenames of locale and code set conversion files For more information on locale files and code set conversion files see page A 12 and page A 16 respectively A 18 Informix Guide to GLS Functionality The Informix registry File For example you can specify the French locale that supports the ISO8859 1 code set with any of the following locale names as locale aliases m The full code set name fr_fr 8859 1 m
319. w types a m Distinct data types In addition Dynamic Server with UD Option provides the following built in data types m Simple large objects TEXT and BYTE BOOLEAN For information about GLS considerations for the TEXT and BYTE data types see Chapter 3 SQL Features The BOOLEAN data type has no GLS considerations The following sections summarize the GLS considerations for the SQL 92 LVARCHAR smart large object complex opaque and distinct data types 4 20 Informix Guide to GLS Functionality SQL 92 Data Types SQL 92 Data Types Dynamic Server with UD Option supports the traditional SQL 92 data types as the following table shows Traditional SQL 92 Data Type Dynamic Server with UD Option Implementation Integer SMALLINT INTEGER INT8 SERIAL SERIAL8 Floating point number SMALLFLOAT FLOAT Character string Fixed CHAR NCHAR Varying VARCHAR NVARCHAR Date and time including interval DATE DATETIME INTERVAL Numeric and decimal DECIMAL MONEY For these data types Dynamic Server with UD Option automatically provides the following locale related tasks It automatically performs code set conversion when it transfers data to and from its operating system files For more information see the discussion of code set conversion in Performing Code Set Conversion on page 4 5 It automatically uses localized collation order for data in NCHAR and NVARCHAR columns For more information on NCH
320. ween groups of digits in the integral part of the numeric value In the default locale the comma is the thousands separator 3 255 in a French locale the space is the thousands separator 3 255 m The number of digits to group between each appearance of a non monetary thousands separator For example this information might specify that numbers always omit the separator at the millions position which produces the following output 1234 345 m The characters that indicate positive and negative numbers In addition to this numeric notation monetary data also uses a currency symbol to identify the currency unit A locale can define this symbol to appear at the front 100 or back 100FF of the monetary value In this manual the combination of currency symbol decimal separator and thousands separator is called currency notation Tip To customize the end user format that the locale defines for monetary values you can use the DBMONEY environment variable For more information see Customizing Monetary Values on page 1 53 The NUMERIC category of the locale file defines the end user formats for numeric data The MONETARY category of the locale file defines the end user formats for monetary data For more information on the NUMERIC and MONETARY categories see page A 7 Date and Time Formats Date data is for DATE or DATETIME columns Time data is for a DATETIME column When an Informix product scans a string that contains ti
Download Pdf Manuals
Related Search
Related Contents
Samsung GT-S7350 manual de utilizador Manual - Sagola NEC Express 320Lc-R User's Manual Installation, Operation and Maintenance Manual プロが教える一歩進んだ子供撮影術 PENTAX MZ-10 取扱説明書 BlueAnt Safe2talk Troubleshooting Copyright © All rights reserved.
Failed to retrieve file