SQL/MP Programming Manual for COBOL

Host Variables
HP NonStop SQL/MP Programming Manual for COBOL529758-003
2-20
Date-Time and INTERVAL Data Types
INVOKE generates this record description in the COBOL format:
01 EMPLOYEE
02 NAME PIC X(18) VALUE SPACES.
02 BIRTH-DATE PIC X(10) VALUE SPACES.
The host variable BIRTH-DATE is referenced in a program:
:BIRTH-DATE TYPE AS DATE
INTERVAL Representation
Suppose that an SQL table has these column definitions:
NAME CHAR(18)
AGE INTERVAL YEAR(2) TO MONTH
Figure 2-2 displays how an interval is represented. The age represented is 37 years,
11 months.
INVOKE generates this record description in the COBOL format:
01 EMPLOYEE
02 NAME PIC X(18) VALUE SPACES.
02 AGE PIC X(6) VALUE SPACES.
The host variable AGE is referenced in a program as follows:
:AGE TYPE AS INTERVAL YEAR(2) TO MONTH
Example—Creating DATETIME and INTERVAL Data Types
Example 2-3 on page 2-21 creates valid DATETIME data types. You can create
INTERVAL data types similarly.
Figure 2-1. DATE Representation
Figure 2-2. INTERVAL Representation
1 9 5 2 0 5 2 8

Year Separator Month Separator Day
VST013.vsd
+ 3 7 1 1
Sign Year Separator Month
VST014.vsd