NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
G-5
Examples—GET VERSION OF PROGRAM
In 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 VERSION OF PROGRAM also sets SQLCODE to report status and fills in the
SQLCA. GET VERSION OF PROGRAM has no EXPLAIN output.
Examples—GET VERSION OF PROGRAM
The following SQLCI example retrieves the PCV, PFV, and HOSV of program
MYPROG:
>>GET CATALOG VERSION OF PROGRAM myprog;
VERSION: 315
--- SQL operation complete.
>>GET FORMAT VERSION OF PROGRAM myprog;
VERSION: 315
--- SQL operation complete.
>>GET HOST OBJECT VERSION OF PROGRAM myprog;
VERSION: 315
--- SQL operation complete.
>>
The following static SQL statement from a C, Pascal, or TAL program retrieves the
PCV of program MYPROG and stores it in hostvar1:
EXEC SQL GET CATALOG VERSION OF PROGRAM myprog
INTO :hostvar1;
The following static SQL statement from a COBOL85 program retrieves the HOSV
of the program MYPROG and stores it in HOSTVAR2:
EXEC SQL GET HOST OBJECT VERSION OF PROGRAM MYPROG
INTO :HOSTVAR2 END-EXEC.
The following COBOL85 example uses dynamic SQL to retrieve the PCV of the
program MYPROG and store it in HOSTVAR3:
MOVE "GET CATALOG VERSION OF PROGRAM MYPROG " TO STRING1.
EXEC SQL PREPARE s1 FROM :STRING1 END-EXEC.
EXEC SQL EXECUTE s1 RETURNING :HOSTVAR3 END-EXEC.