SQL/MP Programming Manual for COBOL

Host Variables
HP NonStop SQL/MP Programming Manual for COBOL529758-003
2-4
Using Corresponding SQL and COBOL Data Types
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.
Numeric Data Types
PIC 9(l-s)V9(s) Same as DECIMAL.
SMALLINT SIGNED PIC S9(4) COMP.
SMALLINT UNSIGNED PIC 9(4) COMP.
INTEGER SIGNED PIC S9(9) COMP.
INTEGER UNSIGNED PIC 9(9) COMP.
LARGEINT SIGNED PIC S9(18) COMP.
FLOAT (1 to 22 bits) Not supported.
REAL Not supported.
FLOAT (23 to 54 bits) Not supported.
DOUBLE PRECISION Not supported.
Date-Time and INTERVAL Data Types
DATETIME PIC X(26).
DATE PIC X(10).
TIME PIC X(8).
TIMESTAMP PIC X(26).
Table 2-1. Corresponding SQL and COBOL Data Types (page 2 of 2)
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.