SQL/MP Programming Manual for COBOL85
Host Variables
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
2-3
Using Corresponding SQL and COBOL Data Types
Fixed-Length Character Data Type With NATIONAL CHARACTER Clause
NATIONAL CHARACTER (l) 01 column-name
CHARACTER SET def-charset
PIC X(l).
Variable-Length Character Data Type
VARCHAR(l) 02 column-name.
03 LEN PIC S9(4) COMP.
03 VAL PIC X(l).
Variable-Length Character Data Type With CHARACTER SET Clause
VARCHAR(l) @@@
CHARACTER SET charset
01 column-name.
02 LEN PIC S9(4) COMP.
02 VAL CHARACTER SET charset
PIC X(l).
Variable-Length Character Data Type With NATIONAL CHARACTER Clause
NATIONAL CHARACTER
VARYING(l)
01 column-name.
02 LEN PIC S9(4) COMP.
02 VAL CHARACTER SET def-charset
PIC X(l).
Numeric Data Types
NUMERIC (1 to 4,s) SIGNED PIC S9(4-s)V9(s) COMP.
NUMERIC (1 to 4,s)
UNSIGNED
PIC 9(4-s)V9(s) COMP.
NUMERIC (5 to 9,s)SIGNED PIC S9(9-s)V9(s) COMP.
NUMERIC (5 to 9,s)
UNSIGNED
PIC 9(9-s)V9(s) COMP.
NUMERIC (10 to 18,s)
SIGNED
PIC S9(18-s)V9(s) COMP.
DECIMAL (l,s) SIGN IS
LEADING
PIC S9(l-s)V9(s)
DISPLAY SIGN IS LEADING.
DECIMAL (l,s) UNSIGNED PIC 9(l-s)V9(s) DISPLAY.
PIC 9(l-s)V9(s) COMP Same as NUMERIC.
Table 2-1. Corresponding SQL and COBOL Data Types (page 2 of 3)
SQL/MP Data Type COBOL Data Type
l is a positive integer that represents the length in characters.
charset is one of these character-set keywords: KANJI, KSC5601, ISO8859n, where n is 1 – 9,
or UNKNOWN (a single-byte unknown character set);
charset must be enclosed in double
quotation marks (").
def-charset is the default multibyte character set; def-charset is KANJI, unless it is
otherwise changed or set during system generation.
s is a positive integer that represents the scale of the number.
HP COBOL treats BINARY as COMPUTATIONAL (or COMP). Therefore, references to
COMPUTATIONAL (or COMP) also apply to BINARY.
The INTERVAL data type has an extra byte to store a sign. This extra byte can contain a blank, plus, or minus.
Indicator variables have the SQL data type SMALLINT SIGNED and the COBOL data type PIC S9(4) COMP.