SQL/MP Programming Manual for COBOL85
Program Execution
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
7-7
Determining Compatibility With the SQL Executor
To determine the PFV of an SQL program, use a FUP INFO or SQLCI FILEINFO
command with the DETAIL option. For programs registered in version 300 (or later)
catalogs, you can also query the PROGRAMS.PROGRAMFORMATVERSION column.
However, for version 300 (or later) SQL/MP software, HP recommends that you use
the GET VERSION OF PROGRAM statement with the FORMAT option. You can enter
this statement from SQLCI or embedded in a COBOL program. To embed a static
GET VERSION OF PROGRAM statement in a COBOL program, you must include the
INTO clause with a host variable. This statement returns the PFV of SQLPROG to the
host variable named HV-PFV:
EXEC SQL
GET FORMAT VERSION OF PROGRAM SQLPROG INTO :HV-PFV
END-EXEC.
You can also execute a dynamic GET VERSION OF PROGRAM statement by using
the PREPARE and EXECUTE statements as shown in this example:
MOVE "GET FORMAT VERSION OF PROGRAM SQLPROG" TO HV-TEXT.
EXEC SQL
PREPARE DYNAMIC-STATEMENT FROM :HV-TEXT
END-EXEC.
EXEC SQL
EXECUTE DYNAMIC-STATEMENT RETURNING :HV-PFV
END-EXEC.
You cannot, however, use a GET VERSION OF PROGRAM statement with the
EXECUTE IMMEDIATE statement.
For the complete syntax of the GET VERSION statements, see the SQL/MP Reference
Manual.