Internationalization Guide
Total Page:16
File Type:pdf, Size:1020Kb
DB2 10 for z/OS Internationalization Guide IBM SC19-2975-10 DB2 10 for z/OS Internationalization Guide IBM SC19-2975-10 Notes Before using this information and the product it supports, be sure to read the general information under “Notices” at the end of this information. October 10, 2017 edition This edition applies to DB2 10 for z/OS (product number 5605-DB2), DB2 10 for z/OS Value Unit Edition (product number 5697-P31), and to any subsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for the level of the product. Specific changes are indicated by a vertical bar to the left of a change. A vertical bar to the left of a figure caption indicates that the figure has changed. Editorial changes that have no technical significance are not noted. © Copyright IBM Corporation 2003, 2017. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this information ............................. v Who should read this information ............................ v DB2 Utilities Suite for z/OS .............................. v Terminology and citations .............................. vi Accessibility features for DB2 10 for z/OS ......................... vi How to send your comments ............................. vii How to read syntax diagrams ............................. vii Chapter 1. Introduction to character conversion .................. 1 Character conversion terminology ............................ 1 Code pages and CCSIDs ............................... 5 Encoding schemes ................................. 7 ASCII..................................... 7 EBCDIC .................................... 8 Unicode ................................... 10 Endianness ................................... 15 Situations in which character conversion occurs ....................... 16 Possible consequences of character conversion ........................ 17 Types of character conversion ............................. 17 Expanding conversion ............................... 17 Contracting conversion .............................. 19 Round-trip conversion............................... 20 Enforced subset conversion ............................. 20 Chapter 2. How DB2 for z/OS uses Unicode .................... 23 Retrieving data from the DB2 catalog........................... 24 Specifying that IFCID output should be in Unicode ...................... 25 Chapter 3. Setting up DB2 to ensure that it interprets characters correctly ...... 27 How DB2 performs character conversions ......................... 27 SYSIBM.SYSSTRINGS catalog table .......................... 28 Finding the CCSID values of your data sources ....................... 29 Specifying CCSIDs in DB2 .............................. 32 Specifying subsystem CCSIDs ............................ 32 Specifying object CCSIDs .............................. 37 Setting up z/OS Unicode Services for DB2 for z/OS...................... 38 Conversion image ................................ 38 | Basic character conversions for DB2 in the z/OS conversion image ................ 39 | Character conversions for Chinese, Japanese, and Korean character sets in the z/OS conversion image .... 42 Defining additional character conversions ......................... 43 Checking defined character conversions .......................... 44 Chapter 4. Storing Unicode data......................... 47 Deciding whether to store data as UTF-8 or UTF-16 ...................... 47 Creating a Unicode table ............................... 48 Tips for handling any extra storage that Unicode data might require ............... 51 Estimating the column size for Unicode data ....................... 52 Inserting data into a Unicode table ........................... 53 Inserting Unicode data into a non-Unicode table ....................... 54 Converting existing DB2 data to Unicode ......................... 54 Effects on access paths when converting data to Unicode .................... 58 Chapter 5. Application programming with Unicode data and multiple CCSIDs ..... 59 Application encoding scheme ............................. 60 © Copyright IBM Corp. 2003, 2017 iii Specifying a CCSID for your application.......................... 61 Details of CCSID options for application programs ..................... 63 Examples of specifying CCSIDs for application data ..................... 66 Specifying CCSIDs for COBOL applications when using the DB2 coprocessor ............ 67 Specifying CCSIDs for PL/I applications when using the DB2 coprocessor ............. 70 Specifying CCSIDs for C/C++ applications when using the DB2 coprocessor ............ 74 Determining the CCSID of DB2 data ........................... 75 Determining the CCSID of a string value in an SQL statement .................. 76 Objects with different CCSIDs in the same SQL statement .................... 76 Differences between Unicode and EBCDIC sorting sequences................... 79 Specifying how DB2 calculates the length of a string ..................... 82 Specifying the sorting sequence for a language ....................... 84 Performing culturally correct case conversions........................ 87 Locale .................................... 89 Generating escaped Unicode data ............................ 91 Normalization of Unicode strings ............................ 93 How DB2 handles Unicode supplementary characters ..................... 94 Processing Unicode data in COBOL applications ....................... 95 Processing Unicode data in PL/I applications ........................ 96 Processing Unicode data in C/C++ applications ....................... 96 Java applications and Unicode data ........................... 97 Green screen applications and Unicode data ........................ 98 Variant characters ................................. 99 | DRDA character type parameters in Unicode ........................ 100 Chapter 6. Debugging CCSID and Unicode problems ............... 101 Potential problems when inserting non-Unicode data into a Unicode table .............. 102 Appendix A. DB2 utilities and Unicode support .................. 103 Appendix B. EXPLAIN Unicode support ..................... 105 Appendix C. DB2 ODBC Unicode support .................... 107 Appendix D. IBM DB2 Tools for z/OS Unicode support............... 109 Appendix E. The International Components for Unicode .............. 111 Appendix F. SYSIBM.SYSSTRINGS table ..................... 113 Information resources for DB2 10 for z/OS and related products .......... 117 Notices ................................... 119 Programming interface information ........................... 120 Trademarks ................................... 121 Terms and conditions for product documentation ...................... 122 Privacy policy considerations ............................. 122 Glossary .................................. 125 Index .................................... 127 iv Internationalization Guide About this information This information describes how to handle international data when working in a DB2® 10 for z/OS® (DB2 for z/OS) environment. This information provides basic guidance about storing and manipulating Unicode data or data from different code pages in a DB2 for z/OS environment. Topics include detailed information about the following tasks: 1. How to set up your subsystem so that DB2 correctly interprets data in any encoding scheme 2. How to store and manipulate Unicode data 3. How to store and manipulate data in multiple encoding schemes 4. How to write applications that correctly interpret data according to the encoding scheme Throughout this information, “DB2” means “DB2 10 for z/OS”. References to other DB2 products use complete names or specific abbreviations. Important: To find the most up to date content, always use IBM® Knowledge Center, which is continually updated as soon as changes are ready. PDF manuals are updated only when new editions are published, on an infrequent basis. This information assumes that your DB2 subsystem is running in DB2 10 new-function mode. Availability of new function in DB2 10 Generally, new SQL capabilities, including changes to existing functions, statements, and limits, become available only in new-function mode, unless explicitly stated otherwise. Exceptions to this general statement include optimization and virtual storage enhancements, which are also available in conversion mode unless stated otherwise. In DB2 Version 8 andDB2 9, most utility functions were available in conversion mode. However, for DB2 10, most utility functions become available in new-function mode. Who should read this information This information is primarily intended for people who are responsible for using character conversion in a DB2 for z/OS environment. It assumes that the user is familiar with the following concepts: v The basic concepts and facilities of DB2 for z/OS environment v The basic concepts of Structured Query Language (SQL) DB2 Utilities Suite for z/OS Important: In DB2 10, the DB2 Utilities Suite for z/OS is available as an optional product. You must separately order and purchase a license to such utilities, and discussion of those utility functions in this publication is not intended to otherwise imply that you have a license to them. DB2 Utilities Suite for z/OS can work with DB2 Sort for z/OS and the DFSORT program. You are licensed to use DFSORT in support of the DB2 utilities even if © Copyright IBM Corp. 2003, 2017 v you do not otherwise license