SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Host Variables in COBOL Programs
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
4-18
Using COBOL Data Description Clauses
Example
A database contains a BILLINGS table consisting of the CUSTNUM, START_DATE, 
BILLING_DATE, and TIME_BEFORE_PMT columns. This example updates date-time 
and interval values: 
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
 ...
 01 BILLINGS-REC.
 02 HV-CUSTNUM PIC 9(4) COMP.
 02 HV-START-DATE PIC X(10).
 02 HV-BILLING-DATE DATE.
 02 HV-TIME-BEFORE-PMT INTERVAL DAY(3).
 EXEC SQL END DECLARE SECTION END-EXEC. 
 ...
 EXEC SQL UPDATE billings
 SET billing_date = :HV-BILLING-DATE,
 time_before_pmt = :HV-TIME-BEFORE-PMT
 WHERE custnum = :HV-CUSTNUM 
 END-EXEC.
 ... 
By default, INTERVAL DAY is 2 digits. Therefore, for the preceding example, declare 
HV-TIME-BEFORE-PMT to be length 3 characters, adding one character for the sign.
Using COBOL Data Description Clauses
Table 4-4 lists the COBOL data description clauses and their interpretation by NonStop 
SQL/MX when they are used in host variable declarations. NonStop SQL/MX does not 
support the COBOL special names option DECIMAL POINT IS COMMA. 
Table 4-4. Interpretation of COBOL Data Description Clauses (page 1 of 2)
COBOL Description Host Variable Interpretation
BLANK The clause is ignored.
data-name Any data name is allowed, including an SQL reserved word. Specific 
hyphenation rules apply.
FILLER The clause is ignored.
JUSTIFIED The clause is not allowed. However, it can appear in an entry 
already being ignored, such as REDEFINES.
level number Any number is allowed. Entries with the level number 66 or 88 are 
ignored.
PICTURE The clause must be consistent with the PICTURE clause rules for 
host variables.
REDEFINES The clause is ignored.
SIGN  For DISPLAY items, the SIGN clause must be LEADING 
SEPARATE. No restrictions apply, and the appropriate conversion 
for SQL data types is made.
COBOL










