Previous Topic: Rules for Coding Host Variables in AssemblerNext Topic: Rules for SQL INCLUDEs in Assembler


Host Variable Declarations for Assembler

In the table below a lowercase n is a number. A lowercase v is a nominal value.

SQL Data Type

Operand Formats

Notes

CHARACTER

C
CLn
C'v'
CLn'v'

 

NUMERIC

Z
ZLn
Z'v'
ZLn'v'

The nominal value is used to determine scale. If no nominal value is given, then the scale is set to zero. For implicit length, the nominal value is used to determine precision and scale. Where both the length modifier and the nominal value are coded, the explicit length from the length modifier is used.

DECIMAL

PLn
P'v'
PLn'v'

The nominal value is used to determine scale. If no nominal value is given, then the scale is set to zero. For implicit length, the nominal value is used to determine precision and scale. Where both the length modifier and the nominal value are coded, the explicit length from the length modifier is used.

SMALLINT

H
HL2
HL2'v'

When the length modifier is coded, it must be two. Any nominal value is ignored.

INTEGER

F
FL4
F'v'
FL4'v'

When the length modifier is coded, it must be four. Any nominal value is ignored.

FLOAT

D
DL8
D'v'
DL8'v'

When the length modifier is coded, it must be eight. Any nominal value is ignored.

DATE

CLn
C'vvv.'
CLn'v'

The length must be 10 or more.

TIME

CLn
C'v'
CLn'v'

The length must be eight or more.

TIMESTAMP

CLn
C'v'
CLn'v'

The length must be 26 or more.

VARCHAR

H,CLn
HL2,CLn
H'vv',C'v'
HL2'v',CLn'v'

The operation must have two and only two operands with the halfword followed by the character. Either, both or neither type may have a nominal value. Likewise a length modifier.

LONG VARCHAR

H,CLn
HL2,CLn
H'vv',C'v'
HL2'v',CLn'v'

The operation must have two and only two operands with the halfword followed by the character. Either, both or neither type may have a nominal value. Likewise a length modifier.

GRAPHIC

DC or DS
GLn or
G'xxxx' or
Gn'xxxx'

 

VARGRAPHIC

DC or DS
H,GLn

 

LONG VARGRAPHIC

DC or DS
H,GLn

 

Note: The CA Datacom/DB Preprocessor for Assembler recognizes GRAPHIC host variables and allows mixed data in literals. The Shift-Out and Shift-In characters specified in the CXXMAINT option of the CA Datacom/DB Utility (DBUTLTY) are used by the Preprocessor.

Example 1

 *------------------------------
 *  Valid host variables
 *------------------------------
 LASTNAME DS   CL30          . CHAR(30)
 POBOX    DS   ZL9           . NUMERIC(9) with scale 0
 ZIPCODE  DS   PL5           . DEC(9,0)
 ZIPSPLIT DS   P'+99999.9999'. DEC(9,4)
 CUR$PAY  DC   H'0'          . SMALLINT
 CUM$PAID DC   F'0'          . INTEGER
 INTRATE  DS   D             . FLOAT(n)
 LACTDATE DC   C'          ' . date area
 LACTTIME DS   CL8           . time area
 LTXNSTMP DC   CL26' '       . timestamp are
 STREET   DS   H'0',CL40     . VARCHAR(40)
 CITY     DS   H,CL30        . VARCHAR(30)
 STATE    DS   H'0',CL20' '  . VARCHAR(20)
 *------------------------------
 *  Indicator variables
 *------------------------------
 NAMEFND DC    H'0'
 ZIPAVAL DS    H