Nonstop Database, HiRDB Version 9 UAP Development Guide
This section describes the organization and contents of the area used for setting character set names for input and output variables that are determined dynamically during UAP execution.
The following figure shows the organization of the character set descriptor area.
Figure E-1 Organization of the character set descriptor area
The following table shows the contents of the character set descriptor area.
Table E-1 Contents of the character set descriptor area
| Level number#1 | Data area name | Data type | Length (bytes) | Source of value | Description |
|---|---|---|---|---|---|
| 1 | SQLCSNA | -- | 32[36]#2 + 2 x n + 64 x m |
-- | Denotes the overall character set descriptor area. |
| 2 | SQLCSNID | char | 8 | HiRDB | Contains the ID "SQLCSNA |
| 2 | SQLCSNBC | long | 4 [8]#2 | HiRDB | Contains the length of the SQLCSNA. This parameter is set when the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued. |
| 2 | SQLCVARN | short | 2 | UAP | When an SQLCSNA area is allocated or SQLCSNA is used, specifies the number of SQLCVARs (1 to 4,000) in the area allocated for the SQLCSNA. |
| HiRDB | Binary 0 is set when the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued and there is a shortage of SQLCSNA area (SQLCVARN < SQLCVARD). | ||||
| 2 | SQLCVARD | short | 2 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the maximum element number of the SQLCVAR for which a character set for input ? parameters has been specified. |
| HiRDB | When the DESCRIBE[OUTPUT], DESCRIBE CURSOR, or PREPARE statement is issued, binary 0, the number of retrieval items, or the maximum element number of the SQLCVAR for which a character set for output ? parameters has been specified is set.
|
||||
| 2 | SQLCSNN | short | 2 | UAP | When an SQLCSNA area is allocated, specifies the number of SQLCSN areas (1) that have been allocated. |
| HiRDB | Binary 0 is set when the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued and there is a shortage of SQLCSN area (SQLCSNN < SQLCSND). | ||||
| 2 | SQLCSND | short | 2 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the number of character sets (1) that are used by input ? parameters. |
| HiRDB | When the DESCRIBE[OUTPUT], DESCRIBE CURSOR, or PREPARE statement has been issued and there is a shortage of SQLCSN area (SQLCSNN < SQLCSND), binary 0 or the number of character sets used for retrieval items or output ? parameters is set.
|
||||
| 2 | SQLCSNEX | -- | 12 | -- | Not used |
| 2 | SQLCVAR | -- | 2 x n | -- | Area composed of SQLCSNXs. This area corresponds to SQLVAR of SQLDA and must be defined as many times as the value specified in SQLCVARN. |
| 3 | SQLCSNX | short | 2 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the element number of the SQLCSN that has a character set name for input ? parameters. |
| HiRDB | When the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued, the element number of the SQLCSN that has the character set name used in retrieval items or ? parameters is set. If the retrieval items or output ? parameters do not contain a character set specification, binary 0 is set. When the DESCRIBE INPUT or PREPARE statement is issued, the element number of the SQLCSN that has the character set name used in input ? parameters is set. If the input ? parameters do not contain a character set specification, binary 0 is set. |
||||
| 2 | SQLCSN | -- | 64 x m | -- | Area composed of SQLCSOL, SQLCSOC, SQLCSNL, and SQLCSNC areas. This area is for the information about one character set and must be defined as many times as the value specified in SQLCSNN. |
| 3 | SQLCSOL | short | 2 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the length of the authorization identifier. |
| HiRDB | When the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued, the length of the authorization identifier is set. | ||||
| 3 | SQLCSOC | char | 30 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the authorization identifier. |
| HiRDB | When the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued, the authorization identifier is set. | ||||
| 3 | SQLCSNL | short | 2 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the length of the character set name. |
| HiRDB | When the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued, the length of the character set name is set. | ||||
| 3 | SQLCSNC | char | 30 | UAP | When the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement is issued, specifies the character set name. |
| HiRDB | When the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued, the character set name is set. |
The following table shows the character set information that UAPs can set in SQLCSN.
Table E-2 Character set information that UAPs can set in SQLCSN
| SQLCSOL | SQLCSOC | SQLCSNL | SQLCSNC |
|---|---|---|---|
| 6 | MASTER | 6 | EBCDIK#1 |
| 6 | MASTER | 8 | UTF-16LE#2 |
| 6 | MASTER | 8 | UTF-16BE#2 |
| 6 | MASTER | 5 | UTF16#2 |
If you use data descriptions in UTF-16 in C language or data descriptions containing Japanese data items (PICTURE N) in COBOL by using COBOL2002's Unicode functionality, you must specify the character sets UTF16, UTF-16LE, and UTF-16BE.
For details about the data descriptions in UTF-16 in C language, see Appendix F.1 SQL data types and C data descriptions. For details about the data descriptions containing Japanese data items (PICTURE N) in COBOL, see F.2 SQL data types and COBOL data descriptions.
The following table shows the attributes of the UTF16, UTF-16LE, and UTF-16BE character sets.
Table E-3 Attributes of the UTF16, UTF-16LE, and UTF-16BE character sets
| Character set name | Usage format | Character repertoire |
|---|---|---|
| UTF-16LE | UTF-16, little endian | Unicode characters that can be coded by using UTF-16 |
| UTF-16BE,UTF16 | UTF-16, big endian |
If you issue a DESCRIBE, DESCRIBE TYPE, DESCRIBE CURSOR, or PREPARE statement to process an SQL retrieval item or a ? parameter whose resulting character set is UTF16, HiRDB sets UTF16 as the character set name in the character set descriptor area.
If you retrieve data from an SQL retrieval item or a ? parameter whose resulting character set is UTF16 by using the OPEN, EXECUTE, EXECUTE IMMEDIATE, or FETCH statement, or if you pass data represented in UTF-16 to HiRDB by using a ? parameter, you must specify UTF16, UTF-16LE, or UTF-16BE as the character set name.
The following figure shows the relationship between the SQL descriptor area and the character set descriptor area.
Figure E-2 Relationship between SQL descriptor area and character set descriptor area
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.