Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

Appendix E.1 Organization and contents of the character set descriptor area

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.

Organization of this subsection
(1) Organization of the character set descriptor area
(2) Contents of the character set descriptor area
(3) Character set information that can be set in SQLCSN in the character set descriptor area
(4) Relationship with the SQL descriptor area

(1) Organization of the character set descriptor area

The following figure shows the organization of the character set descriptor area.

Figure E-1 Organization of the character set descriptor area

[Figure]

Note 1
Numbers in parentheses indicate area length (in bytes).

Note 2
n indicates the number of SQLCVARs specified in SQLCVARN.
m indicates the number of SQLCSNs specified in SQLCSNN.

Note 3
A value in square brackets ([ ]) within parentheses indicates the length in 64-bit mode. The value for 64-bit mode Windows is the same as for 32-bit mode.

Note 4
In 64-bit mode, the length of SQLCSNBC becomes the size of the long type for each platform.

(2) Contents 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[Figure]," indicating the SQLCSNA. This parameter is set when the DESCRIBE, DESCRIBE CURSOR, or PREPARE statement is issued.
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.

0:
This value is set in either of the following cases:
  • The SQL statement was a statement other than a SELECT statement and was not a CALL statement containing output ? parameters.
  • The retrieval items or output ? parameters do not have a character set other than the default character set.

maximum-element-number:
This value is set when both of the following conditions are satisfied:
  • The SQL statement was a SELECT statement or a CALL statement containing an output ? parameter.
  • A retrieval item or an output ? parameter has a character set other than the default character set.
When the DESCRIBE INPUT or PREPARE statement is issued, binary 0 or the maximum element number of the SQLCVAR containing character set information for input ? parameters is set.

0:
This value is set in either of the following cases:
  • The SQL statement does not contain input ? parameters.
  • The input ? parameters do not have a character set other than the default character set.

maximum-element-number:
This value is set when both of the following conditions are satisfied:
  • The SQL statement contains an input ? parameter.
  • An input ? parameter has a character set other than the default character 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.

0:
This value is set in either of the following cases:
  • The SQL statement was a statement other than a SELECT statement and was not a CALL statement containing output ? parameters.
  • The retrieval items and output ? parameters do not have a character set other than the default character set.

maximum-element-number:
This value is set when both of the following conditions are satisfied:
  • The SQL statement was a SELECT statement or a CALL statement containing an output ? parameter.
  • A retrieval item or an output ? parameter has a character set other than the default character set.
When the DESCRIBE INPUT or PREPARE statement is issued, binary 0 or the number of character sets used in input ? parameters is set.

0:
This value is set in either of the following cases:
  • The SQL statement does not contain input ? parameters.
  • The input ? parameters do not have a character set other than the default character set.

maximum-element-number:
This value is set when both of the following conditions are satisfied:
  • The SQL statement contains an input ? parameter.
  • An input ? parameter has a character set other than the default character 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.

Legend:
[Figure]: One space
--: Not applicable

#1
Level numbers indicate the set inclusion relationships of the character set descriptor area. For example, the level 1 data area is composed of level 2 data areas.

#2
Square brackets ([ ]) enclose the length for 64-bit mode. For 64-bit mode Windows, the length is the same as for 32-bit mode.

(3) Character set information that can be set in SQLCSN in the character set descriptor area

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

#1
This value can be used only when sjis is specified as the character code type by the pdntenv command (in the UNIX edition, pdsetup command).

#2
This value can be used only when utf-8 is specified as the character code type by the pdntenv command (in the UNIX edition, pdsetup command).

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.

(4) Relationship with the SQL descriptor area

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

[Figure]

Legend:
N: SQLN setting (maximum number of SQLVARs)
D: SQLD setting (valid number of SQLVARs)
n: SQLCVARN setting (maximum number of SQLCVARs)
dn: SQLCVARD setting (valid number of SQLCVARs)
m: SQLCSNN setting (maximum value of SQLCSN)
dm: SQLCSND setting (valid value of SQLCSN)