Nonstop Database, HiRDB Version 9 UAP Development Guide
You allocate the character set descriptor area by declaring it within a UAP.
This section presents the format of a character set descriptor area that is expanded within a source program, and provides usage examples.
The following shows the expansion format of the character set descriptor area in C language:
struct { char sqlcsnid[8]; /* name indicating SQLCSNA */ long sqlcsnbc; /* length of SQLCSNA */ short sqlcvarn; /* number of elements in the SQLCVAR array */ short sqlcvard; /* valid number of SQLCVARs */ short sqlcsnn; /* number of elements in the SQLCSN array */ short sqlcsnd; /* valid number of SQLCSNs */ char sqlcsnex[12]; /* reserved */ struct sqlcvar { short sqlcsnx; /* number of SQLCSN that has the */ /* corresponding character set name */ } SQLCVAR[m]; #1 struct sqlcsn { short sqlcsol; /* valid length of authorization identifier */ char sqlcsoc[30]; /* authorization identifier storage area */ short sqlcsnl; /* valid length of character set name */ char sqlcsnc[30]; /* character set name storage area */ } SQLCSN[n]; #2 } sqlcsna; #3
#1: m specifies the required number of items (1 to 30000).
#2: n specifies the required number of items (1).
#3: For a structure name (the sqlcsna part), specify any desired character string. A structure name cannot begin with SQL.
The following shows the expansion format of the character set descriptor area in COBOL:
01 USQLCSNA.#1 02 USQLCSNID PIC X(8) VALUE 'SQLCSNA'. 02 USQLCSNBC PIC S9(9) COMP.#4 02 USQLCVARN PIC S9(4) COMP. 02 USQLCVARD PIC S9(4) COMP. 02 USQLCSNN PIC S9(4) COMP. 02 USQLCSND PIC S9(4) COMP. 02 USQLCSNEX PIC X(12). 02 USQLCVAR OCCURS m TIMES. #2 03 USQLCSNX PIC S9(4) COMP. 02 USQLCSN OCCURS n TIMES. #3 03 USQLCSOL PIC S9(4) COMP. 03 USQLCSOC PIC X(30). 03 USQLCSNL PIC S9(4) COMP. 03 USQLCSNC PIC X(30).
#1: Any name can be specified for the set item (the USQLCSNA part). The data items cannot begin with SQL.
#2: m specifies the required number of items (1 to 30000).
#3: n specifies the required number of items (1).
#4: In 64-bit mode UNIX, change the PICTURE clause of USQLCSNBC to S9(18).
The following table describes how to expand the character set descriptor area.
Table E-4 How to expand the character set descriptor area
Language | Using an include file | Direct specification by the user |
---|---|---|
C | #include <pdbsqlcsna.h> PDUSRSQLCSNA(m,n) usrsqlcsna For details about m, n, and usrsqlcsna, see (3) Character set descriptor area operation macros. |
The user directly codes the expanded format of the character set descriptor area. |
COBOL | COPY SQLCSNA# [ REPLACING 256 BY m ==OCCURS 1 == BY ==OCCURS n == ]. |
The user directly codes the expanded format of the character set descriptor area. Coding must begin at the 01 level. |
#: In 64-bit mode, change SQLCSNA to SQLCSNA64.
Various macros for declaring SQLCSNA and for setting/referencing values are defined in C language. These macros can be used by including a unique header file (pdbsqlcsna.h) in the UAP. Table E-5 lists the character set descriptor area operation macros and the macros for specifying character set names.
Table E-5 Character set descriptor area operation macros
Macro | Function |
---|---|
PDUSRSQLCSNA(m,n) | Declares a user SQLCSNA. |
PDSETCSNASIZE(usrsqlcsna,m,n) | Specifies the size of the SQLCSNA. |
PDSQLCVARN(usrsqlcsna) | Specifies the number of elements in an SQLCVAR array. |
PDSQLCVARD(usrsqlcsna) | Specifies and references the valid number of SQLCVARs. |
PDSQLCSNN(usrsqlcsna) | Specifies the number of elements in an SQLCSN array. |
PDSQLCSND(usrsqlcsna) | Specifies and references the valid number of SQLCSNs. |
PDSQLCSNX(usrsqlcsna,o) | Specifies and references the number assigned to the SQLCSN that has the corresponding character set name. |
PDSQLCSOL(usrsqlcsna,p) | Specifies and references the length of the authorization identifier for a character set. |
PDSQLCSOC(usrsqlcsna,p) | Specifies and references the authorization identifier for a character set. |
PDSQLCSNL(usrsqlcsna,p) | Specifies and references the length of a character set's character set name. |
PDSQLCSNC(usrsqlcsnaa,p) | Specifies and references a character set's character set name. |
Table E-6 Macros for specifying character set names
Macro | Function |
---|---|
PDSQL_CS_MASTER_L | Length of the authorization identifier MASTER |
PDSQL_CS_MASTER_C | Character string of the authorization identifier MASTER |
PDSQL_CS_EBCDIK_L | Length of the character set name EBCDIK |
PDSQL_CS_EBCDIK_C | Character string of the character set name EBCDIK |
PDSQL_CS_UTF16_L | Length of the character set name UTF16 |
PDSQL_CS_UTF16_C | Character string of the character set name UTF16 |
PDSQL_CS_UTF_16LE_L | Length of the character set name UTF-16LE |
PDSQL_CS_UTF_16LE_C | Character string of the character set name UTF-16LE |
PDSQL_CS_UTF_16BE_L | Length of the character set name UTF-16BE |
PDSQL_CS_UTF_16BE_C | Character string of the character set name UTF-16BE |
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.