SQL/MP Programming Manual for COBOL

Error and Status Reporting
HP NonStop SQL/MP Programming Manual for COBOL529758-003
9-2
Generating Structures With Different Versions
{ SQLCA | SQLSA | SQLDA } VERSION
are keywords that specify the SQLCA, SQLSA, or SQLDA structure, respectively.
version
is the version number of the generated data structures. version can be 1, 2,
300, or later.
{ SQLCA | SQLSA } [ EXTERNAL ]
specifies that the structures are declared as external, making it possible to share
them among subprograms of the main program.
As a result, the SQLCA object or the SQLSA object can be referenced by any
subprogram in the main program that describes the object. All such descriptions
must be identical, or the results of the references are unpredictable. References to
an external object from different programs are always to the same object. In the
main program, there is only one representation of an external object. The storage
associated with that object is associated with the main program rather than with
any particular program within it.
Generating Structures With Different Versions
You can generate SQL structures that are all the same version or structures of different
versions. For example, to generate all version 310 structures in a program, specify this
directive:
EXEC SQL INCLUDE STRUCTURES ALL VERSION 310 END-EXEC.
Or, to generate different versions for each structure, specify this directive:
EXEC SQL INCLUDE STRUCTURES
SQLCA VERSION 2
SQLSA VERSION 2
SQLDA VERSION 310
END-EXEC.
Checking the Version of the HP COBOL Compiler
If you try to compile a COBOL program that uses the INCLUDE STRUCTURES
directive to specify a later version of a structure than the HP COBOL compiler can
generate, the compiler returns SQL error 11203. To determine the version of the HP
COBOL compiler before you compile a program, run the VPROC program for the HP
COBOL compiler object file. Then, check the version in the VPROC line that contains
S7094, which is the SQL compiler interface (SCI) product number.
When you compile the program, you can specify the SQLMAP option in the SQL
compiler directive. The SQLMAP option directs the HP COBOL compiler to include the
host object SQL version (HOSV) in the map at the end of the source-file listing. For
example, a version 310 HP COBOL compiler listing includes this line:
Host Object SQL Version = 310