SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
C-106
Conversion of DDL Elementary Items
This special DDL group is converted to the SQL VARCHAR data type:
02 A-VARCHAR.
03 LEN PIC S9(4) COMP.
03 VAL PIC N(len).
The field names in the special DDL group have these meanings:
A-VARCHAR is the name of the special DDL VARCHAR group. Any valid DDL
group name can be used in place of A-VARCHAR.
LEN is a numeric field representing the actual length of the string. The string must
be defined as LEN PIC S9(4) COMP for the group to be recognized as this special
DDL group.
VAL is a fixed-length character field representing the maximum length of the string.
The data type of the character field can be PIC X(n), PIC A(n), TYPE
CHARACTER, or PIC N(n).
This table shows how variable-length character strings are converted, depending on
the option you specify.
Conversion of Variable-Length Strings
TYPE LOGICAL 1 PIC X
TYPE LOGICAL 2 SMALLINT
TYPE LOGICAL 4 INTEGER
With VARCHARS Option
CONVERT Option
SQL Data Type
PIC N Field
SQL Data Type
PIC X, PIC A or
CHARACTER Field
None VARCHAR(m) VARCHAR(j)
CHARACTER set VARCHAR(x)
CHARACER SET set
NATIONAL set VARCHAR(y)
CHARACTER SET set
NATIONAL DEFAULT NCHAR VARYING(k)
set An SQL-supported character set
j The number of single-byte characters
k The number of double-byte characters
m The number of characters; m is twice the corresponding k
x The number of characters; x equals j for single-byte character sets and equals j/2 for
double-byte character sets
y The number of characters; y equals k for double-byte character sets and equals twice k for
single-byte character sets
DDL NonStop SQL/MP