SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
G-4
GET VERSION OF PROGRAM Statement
This COBOL example uses dynamic SQL to retrieve the version of catalog
\sysa.$vol1.mycat and store it in an SQLDA:
MOVE "GET VERSION OF CATALOG \sysa.$vol1.mycat" TO string1.
EXEC SQL PREPARE s1 FROM :string1 END-EXEC.
EXEC SQL EXECUTE s1
RETURNING USING DESCRIPTOR :mysqlda END-EXEC.
GET VERSION OF PROGRAM Statement
GET VERSION OF PROGRAM is a DSL statement that returns the program catalog
version (PCV), program format version (PFV), or host object SQL version (HOSV) of
an SQL program that is registered in an SQL catalog.
{ CATALOG | FORMAT | HOST OBJECT }
specifies the type of program version to return: PCV (CATALOG), PFV (FORMAT),
or HOSV (HOST OBJECT).
program
is the Guardian name of the program for which to return a version. (If the program
is an SQL program in an OSS file, program must be the Guardian-format ZYQ
name of the program file, not the pathname.)
For a CATALOG or FORMAT version, program must be an existing program that
has been SQL-compiled. For a HOST OBJECT version, program must be an
existing program that has been host language-compiled (and might have been
SQL-compiled).
INTO :var
(static SQL programs only) specifies a host variable in which to return the version
number.
Consideration—GET VERSION OF PROGRAM
In host language programs, GET VERSION OF PROGRAM returns an integer value.
The variable to receive the value must be compatible with the SQL data type
UNSIGNED SMALLINT.
For static SQL, specify the variable in the INTO clause of GET VERSION OF
PROGRAM. For dynamic SQL, specify the variable in the RETURNING clause of the
EXECUTE or specify an output SQLDA in the RETURNING USING DESCRIPTOR
clause of the EXECUTE. (You cannot use GET VERSION OF PROGRAM with
EXECUTE IMMEDIATE.)
GET { CATALOG | FORMAT | HOST OBJECT }
VERSION OF PROGRAM program [ INTO :var ]