SQL/MP Programming Manual for COBOL

Program Execution
HP NonStop SQL/MP Programming Manual for COBOL529758-003
7-8
Determining Compatibility With the SQL Executor
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.