Scalable Database Server, HiRDB Version 8 UAP Development Guide
This section provides the correspondence between SQL data types and COBOL data descriptions.
Data can be exchanged between variables of compatible data types and between variables of either convertible or assignable data types.
Table E-8 shows SQL data types and COBOL data descriptions. Table E-9 shows SQL data types and COBOL data descriptions when arrays are used. Table E-10 shows SQL data types and COBOL data descriptions when repetition columns are used. Note that the data descriptions in these tables can also be coded as follows:
Table E-8 SQL data types and COBOL data descriptions
SQL data type | COBOL data description | Item coding | Remarks | |
---|---|---|---|---|
SMALLINT |
|
elementary-item or independent-item | ||
INTEGER |
|
elementary-item or independent-item | ||
DECIMAL [(p[,s])] |
|
elementary-item or independent-item | If 1 p 2910, 0 s p, and p = s, then SV9(s). If s = 0, then [V9(s)] is omitted. |
|
L1 elementary-item-name PICTURE S9(p-s)[V9(s)] DISPLAY SIGN
|
||||
SMALLFLT (REAL) |
|
elementary-item or independent-item | ||
FLOAT (DOUBLE PRECISION) |
|
elementary-item or independent-item | ||
CHAR [(n)] |
|
elementary-item or independent-item | 1 n 30000 | |
VARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items elementary-item-name-1: character-string-length elementary-item-name-2: character-string |
1 n 32000 | |
NCHAR [(n)] | L1 elementary-item-name PICTURE N(n). |
elementary-item or independent-item | 1 n 15000 | |
NVARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items
|
1 n 16000 | |
MCHAR [(n)] | L1 elementary-item-name PICTURE X(n).6 |
elementary-item or independent-item | 1 n 30000 | |
MVARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items
|
1 n 32000 | |
DATE |
|
elementary-item or independent-item | ||
TIME |
|
elementary-item or independent-item | ||
TIMESTAMP[(p)] | L1 elementary-item-name PICTURE X(n).6 | elementary-item or independent-item | If p = 0, n = 19. If p = 2, n = 21 or 22. If p = 4, n = 23 or 24. If p = 6, n = 25 or 26. |
|
INTERVAL YEAR TO DAY |
|
elementary-item or independent-item | ||
INTERVAL HOUR TO SECOND | L1 elementary-item-name PICTURE S9(6) COMPUTATIONAL-3. |
elementary-item or independent-item | ||
ROW3 | Combination of data items and group items in this table1 | A group item composed of elementary items | 1 total-length 30000 |
|
BLOB |
|
elementary-item | Default: 1 n 2147483647 In units of K: 1 n 2097152 In units of M: 1 n 2048 In units of G: 1 n 2 |
|
BINARY(n) | L2 group-item-name. L3 elementary-item-name-1 PICTURE S9(9) COMPUTATIONAL. L3 elementary-item-name-2 PICTURE X(n).5, 7 |
A group item composed of two elementary items elementary-item-name-1: character-string-length elementary-item-name-2: character-string character-string-length is the byte count. |
1 n 2147483647 | |
BLOB locator | L1 elementary-item-name SQL TYPE IS BLOB AS LOCATOR.8 |
elementary-item or independent-item | ||
BINARY locator | L1 elementary-item-name SQL TYPE IS BINARY AS LOCATOR.8 |
elementary-item or independent-item | ||
Indicator variable | Other than BLOB, BINARY, BLOB locator, or BINARY locator |
|
elementary-item or independent-item | |
BLOB, BINARY, BLOB locator, or BINARY locator |
|
|||
SQL statement | L2 group-item-name
|
A group item composed of two elementary items
|
1 n 2000000 |
L2 group-item-name. 49 group-item-name_RESERVED PIC S(9) USAGE IS BINARY. 1 49 group-item-name_LENGTH PIC S(9) USAGE IS BINARY. 2 49 group-item-name_DATA PIC X(m). 3
5 This item can be defined using 9 in place of X. If 9 is used for definition, the operation when a character string containing a character other than a number is substituted or received as the retrieval result depends on the installed COBOL compiler.
L1 elementary-item-name PICTURE S9(9) COMPUTATIONAL.
Table E-9 SQL data types and COBOL data descriptions when arrays are used
SQL data type | COBOL data description | Item coding | Remarks | |
---|---|---|---|---|
SMALLINT |
|
A group item composed of repetitions of data items in which the same data structure is repeated through specification of OCCURS | ||
INTEGER |
|
|||
DECIMAL [(p[,s])] |
|
1 p 293, 0 s p If p = s, SV9(s) is used. If s = 0, [V9(s)] is omitted. |
||
L2 elementary-item-name PICTURE S9(p-s)[V9(s)] DISPLAY SIGN LEADING SEPARATE OCCURS m
|
||||
SMALLFLT (REAL) |
|
|||
FLOAT (DOUBLE PRECISION) |
|
|||
CHAR [(n)] |
|
1 n 30000 | ||
VARCHAR (n) | L2 group-item-name OCCURS m TIMES.
|
1 n 32000 | ||
NCHAR [(n)] |
|
1 n 15000 | ||
NVARCHAR (n) | L2 group-item-name OCCURS m TIMES.
|
1 n 16000 | ||
MCHAR [(n)] |
|
1 n 30000 | ||
MVARCHAR (n) | L2 group-item-name-2 OCCURS m TIMES.
|
1 n 32000 | ||
DATE |
|
|||
TIME |
|
|||
TIMESTAMP(n) | L2 elementary-item-name PICTURE X(n) OCCURS m TIMES.2 |
If p = 0, n = 19. If p = 2, n = 21 or 22. If p = 4, n = 23 or 24. If p = 6, n = 25 or 26. |
||
INTERVAL YEAR TO DAY |
|
|||
INTERVAL HOUR TO SECOND |
|
|||
ROW |
|
|||
BLOB | CN | CN | ||
BINARY | L2 group-item-name-2 OCCURS m TIMES. L3 elementary-item-name-1 PICTURE S9(9) COMPUTATIONAL. L3 elementary-item-name-2 PICTURE X(n).1 |
A group item composed of repetitions of data items in which the same data structure is repeated through specification of OCCURS. |
|
|
BLOB locator | ||||
BINARY locator | L2 elementary-item-name SQL TYPE IS BINARY AS LOCATOR OCCURS m TIMES. |
Group item consisting of iterative data items that repeat the same data structure according to the OCCURS specification | ||
Indicator variable | Other than BINARY or BINARY locator |
|
||
BINARY or BINARY locator | L2 elementary-item-name PICTURE S9(9) COMPUTATIONAL OCCURS m TIMES. |
|||
SQL statement | CN | CN |
Table E-10 SQL data types and COBOL data descriptions when repetition columns are used
SQL data type | COBOL data description | Item coding | Remarks |
---|---|---|---|
SMALLINT | L2 group-item-name
|
A group item composed of two elementary items | |
INTEGER | L2 group-item-name
|
||
DECIMAL [(p[,s])] | L2 group-item-name
|
1 p 293, 0 s p When p = s, SV9(s) is used. When s = 0, [V9(s)] is omitted. |
|
L2 group-item-name. L3 elementary-item-name-1 PICTURE S9(9) COMPUTATIONAL. L3 elementary-item-name-2 PICTURE S9(p-s)[V9(s)] DISPLAY SIGN LEADING SEPARATE OCCURS m TIMES. |
|||
SMALLFLT (REAL) | L2 group-item-name
|
||
FLOAT (DOUBLE PRECISION) | L2 group-item-name
|
||
CHAR [(n)] | L2 group-item-name
|
1 n 30000 | |
VARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items and a group item composed of one elementary item. | 1 n 32000 |
NCHAR [(n)] | L2 group-item-name
|
A group item composed of two elementary items. | 1 n 15000 |
NVARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items and a group item composed of one elementary item. | 1 n 16000 |
MCHAR [(n)] | L2 group-item-name
|
A group item composed of two elementary items. | 1 n 30000 |
MVARCHAR (n) | L2 group-item-name
|
A group item composed of two elementary items and a group item composed of one elementary item. | 1 n 32000 |
DATE | L2 group-item-name
|
A group item composed of two elementary items. | |
TIME | L2 group-item-name
|
||
TIMESTAMP[(n)] | L2 group-item-name. L3 elementary-item-name-1 PICTURE S9(9) COMPUTATIONAL. L3 elementary-item-name-2 PICTURE X(n) OCCURS m TIMES.2 |
If p = 0, n = 19. If p = 2, n = 21 or 22. If p = 4, n = 23 or 24. If p = 6, n = 25 or 26. |
|
INTERVAL YEAR TO DAY | L2 group-item-name
|
||
INTERVAL HOUR TO SECOND | L2 group-item-name
|
||
ROW | CN | CN | |
BLOB | CN | CN | |
BINARY | CN | CN | |
BLOB locator | CN | CN | |
BINARY locator | CN | CN | |
Indicator variable (other than BLOB, BINARY, BLOB locator, or BINARY locator) | L2 group-item-name
|
A group item composed of two elementary items. | |
SQL statement | CN | CN |
1 This item can be defined using 9 in place of X. If 9 is used for definition, the operation when a character string containing a character other than a number is substituted or received as the retrieval result depends on the installed COBOL compiler.
2 Do not use 9 for X during definition, although using 9 does not result in an error during preprocessing.
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.