SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
H-6
Host Programs
Host Programs
A host program or host language program is a program that contains both host-
language statements and embedded SQL statements.
You can write SQL/MP host programs in C, COBOL, Pascal, or TAL. For more
information, see one of these manuals:
SQL/MP Programming Manual for C
SQL/MP Programming Manual for COBOL
SQL Programming Manual for Pascal
SQL Programming Manual for TAL
C programs can run in the Guardian or OSS environments; other programs run only in
the Guardian environment.
Host Variables
Host variables are data items declared in a host program and used in both host
language statements and SQL statements. They provide for communication between
SQL and the host language.
A host variable can be any valid host -language variable that has a corresponding SQL
data type. You can include host variables in many SQL statements and in SQL
expressions. The syntax for a host variable that appears in an SQL statement follows:
host-identifier
is the name of the host variable as declared in the host program; host-
identifier must conform to the naming rules of the host language.
[INDICATOR]:indicator-host-identifier
specifies an indicator variable for handling null values returned to the host variable
or inserting null values into the database through the host variable. For more
information, see Indicator Variables and Indicator Parameters on page I-11.
:host-identifier[[INDICATOR]:indicator-host-identifier]
[ TYPE AS { DATETIME [ start-dt TO ] end-dt } ]
[ { } ]
[ { DATE | TIME | TIMESTAMP } ]
[ { } ]
[ { INTERVAL start-dt } ]
[ { [ (start-field-precision) ] } ]
[ { [ TO end-dt ] } ]