SQL/MP Programming Manual for COBOL

Host Variables
HP NonStop SQL/MP Programming Manual for COBOL529758-003
2-18
Embedded Sign in a Decimal Data Type
Embedded Sign in a Decimal Data Type
SQL/MP supports only leading embedded signs for columns defined with a decimal
data type. Therefore, you cannot directly specify or use INVOKE to generate host
variables with embedded trailing signs from numeric columns defined as either of
these:
PICTURE S 9(n) DISPLAY or DECIMAL (n,s) SIGNED
To use a trailing sign with a numeric variable, follow these steps:
1. Use INVOKE to declare a host variable with a leading embedded sign.
2. Define a corresponding COBOL variable with a trailing sign.
3. Read data into the host variable with a leading sign.
4. Move the data to the COBOL variable with a trailing sign.
System-Defined Primary Key (SYSKEY)
INVOKE generates a host variable declaration for each column specified in the
CREATE TABLE or CREATE VIEW statement that created the table or view definition.
Therefore, if a system-defined primary key (SYSKEY) is specified for a view, INVOKE
generates a host variable for SYSKEY. If SYSKEY is not specified for a view, INVOKE
Column or Data Type Description of Change
Underscore (_) within a name Converts underscores to hyphens (–). For example, the
column name CITY_STREET becomes CITY-STREET.
Underscore (_) at the end of a
name
Truncates the underscore so that the resulting COBOL
name does not end in a hyphen. For example, the column
name HOME_ becomes HOME.
Column with VARCHAR data
type
Creates a group item with two elementary data items. The
group item name is derived from the VARCHAR column
name. The data names of the subordinate data items are:
LEN, a numeric data item for the length.
VAL, a fixed-length character data item for the string,
with the maximum length specified by the VARCHAR
column definition.
For example, CUSTNAME defined as VARCHAR (26)
becomes this group item:
02 CUSTNAME.
03 LEN PIC S9(4) COMP.
03 VAL PIC X(26).
DATETIME, DATE, TIME,
TIMESTAMP, or INTERVAL
data type
Converts columns to character fields. The size is
determined by the date-time or INTERVAL fields.
INTERVAL columns have an additional byte for a sign
(that is, a negative interval is possible). The format of the
column is the DEFAULT format (ANSI).