SQL/MP Programming Manual for COBOL85

Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for COBOL85429326-004
10-16
Defining Storage for Input and Output Parameters
CPRULES
is a keyword that is required if you specify a collation buffer.
collation-buffer
is a host variable that is a COBOL record name of the collation buffer. The
DESCRIBE statement includes the COLLATIONS INTO clause, which directs
SQL/MP to return collations to collation-buffer.
For more information, see Calculating the Lengths of the Names and Collation
Buffers on page 10-20.
max-collation-size
is the maximum number of bytes you expect for any one collation.
Considerations
These guidelines apply to the use of the INCLUDE SQLDA directive:
You must supply both the number of parameters you expect as well as the
maximum lengths of their names. Be sure to specify sufficient numbers and sizes.
You can specify large numbers to ensure that any data you might obtain at run time
will fit. If you are not concerned about memory use, this approach is most efficient.
Declare buffers in working storage. Use redefines to store differing data types.
One reason to specify a collation buffer is to access collation rules in your COBOL
code so that you can make comparisons using the same rules that SQL/MP does
for a given column.
Examples
In this example, the INCLUDE SQLDA directive generates a version 300 SQLDA
structure named SQLDAX with these buffers:
NAMES-BUFFER, which reserves space for 20 names with a maximum length of
30 bytes each
COLLATION-BUFFER, which supports collations with a maximum length of 512
bytes each
The INCLUDE STRUCTURES and INCLUDE SQLDA directives in the COBOL
program are as follows:
DATA DIVISION.
EXEC SQL INCLUDE STRUCTURES SQLDA VERSION 315 END-EXEC.
...
EXEC SQL INCLUDE SQLDA (SQLDAX, 20, NAMES-BUFFER, 30,
CPRULES COLLATION-BUFFER, 512)
END-EXEC.