SQL/MP Version Management Guide

Program Versions
Compaq NonStop™ SQL/MP Version Management Guide429833-001
5-4
Retrieving the Host Object’s SQL Version
When you compile a source file that contains the pragma shown above, the C compiler
places the compiler version in its compiled source listing:
Host Object SQL Version = 310
When the COBOL85 compiler compiles a program by using the SQLMAP option of the
SQL directive, the compiler places its own SQL version in the summary section of the
compiler listing.
For example, to retrieve the COBOL85 host language compiler SQL version, include the
following directive in your source program:
?SQL SQLMAP
The COBOL85 compiler then displays the compiler version in its compiled listing:
Host Object SQL Version = 310
Similarly, the COBOL85 preprocessor displays the preprocessor version at the end of
the preprocessor listing.
Retrieving the Host Object’s SQL Version
The GET VERSION OF PROGRAM statement returns the program catalog version, the
program format version, or the host object SQL version of an SQL program.
You can execute the GET VERSION OF PROGRAM statement in a static or dynamic
SQL program. Alternatively, you can execute it as an SQLCI command. Executed in
either way, GET VERSION OF PROGRAM returns the version of the host object SQL
file.
The GET VERSION OF PROGRAM statement is not available in version 1 or version 2
SQL software. You must enter the statement from a node running version 300 or newer
software. In a network, you can execute the GET VERSION OF PROGRAM statement
to retrieve the version of a host object SQL file on a remote node, even if the software
on the remote node is an older version.
For example, suppose you want to retrieve the host object SQL version of the host
object SQL file PROGA, which has been host language compiled into a file named
\SYS2.$VOL1.MYSVOL.PROGA. You can issue the following SQLCI commands:
>> VOLUME \SYS2.$VOL1.MYSVOL;
>> GET HOST OBJECT VERSION OF PROGRAM PROGA;
If the host object SQL version of the host object SQL file PROGA is 315, the result of
the previous statements is:
VERSION: 315
--- SQL operation complete.
You cannot use the EXECUTE IMMEDIATE statement with the GET VERSION OF
PROGRAM statement.
For more information and additional examples, see the NonStop SQL/MP Reference
Manual.