SQL/MP Version Management Guide

Version Compatibility for SQL Programs
Compaq NonStop™ SQL/MP Version Management Guide429833-001
7-5
Version Independent SQL Data Structures
If you upgrade the SQLDA structure to a newer version, initialize any fields in the
new SQLDA structure that the older version structure did not contain.
If you allocate SQL data structures at run time (not necessary if you use INCLUDE
STRUCTURES), use the length literals returned by version 300 and newer
INCLUDE directives rather than specifying a length directly. Following this
guideline reduces the impact on your program if the structure length changes in a
future version.
Use the eye-catcher literals returned by the INCLUDE SQLCA, INCLUDE SQLSA
or INCLUDE SQLDA directives to indicate the particular data structure (SQLCA,
SQLSA, or SQLDA) rather than coding the eye-catcher values in your program.
Do not access SQLCA fields directly from a COBOL85 program; instead, use the
SQLCAGETINFOLIST procedure.
For more information on using the SQL data structures, see the NonStop Programming
Manual for the language you are using. For a summary of the changes that exist between
versions of the SQL data structures, see Appendix A, Summary of Feature, Catalog, and
Data Structure Changes.
Converting Programs to Use New Versions of SQLDA
When you modify a program to use new features supported by version 300 or newer
SQL data structures, the SQLDA data structure requires special handling. To convert a
program to use SQLDA structures that are all version 300 or newer, in addition to
following the guidelines listed previously, you must observe three rules that are specific
to the SQLDA data structure:
Remove any RELEASE options. If your program contains any references to SQLDA
names with the suffix _R1 or _R2, remove the suffix from those references.
If you are converting from version 1 SQLDA structures and plan to use features that
were introduced with version 300 or newer, add code to initialize the new
NULL_INFO and IND_PTR fields. Version 2 programs should already contain this
code. Even if you do not plan to use version 300 or newer features, you should
initialize the new fields. (For a list of features introduced with versions 300, 310,
and 315, see Appendix A, Summary of Feature, Catalog, and Data Structure
Changes.)
Place the INCLUDE STRUCTURES directive in your code in the form INCLUDE
STRUCTURES ALL VERSION version or in the form INCLUDE STRUCTURES
SQLDA version, where version stands for version 300 or newer.
There are several ways to modify a program to use a particular version of the SQLDA
data structure. The most common technique is to use SQLDA structures that are all
version 300 or newer, as explained under Converting Programs to Use New Versions of
SQLDA on page 7-5. However, there could be occasions when you want to continue
using all version 1 SQLDA structures or all version 2 SQLDA structures. You might
also want to use different versions of SQLDA in different modules of a program.
To continue using version 2 SQLDA structures in a version 300 or newer program,
follow the preceding guidelines for converting to a version 300 or newer SQLDA, but