SESAM CLI calls can be issued from C or COBOL programs.
They all have the following basic structure:
cli_call ::=
cli_procedure_name (
cli_parameters [,
cli_parameters ]...)
cli_parameters ::=
cli_parameter_name { IN | IN OUT | OUT }
cli_parameter_data_type
cli_parameter_data_type ::= { BOOLEAN | INTEGER | CHAR(
max ) | POINTER | SQLda }
cli_procedure_name
Name of the calling CLI procedure. Each procedure has a long name and a short name. The long form should be used in C. The short form should be used in COBOL (see alphabetical reference section).
cli_parameter_name
Name of the parameter (see alphabetical reference section).
IN
, IN OUT
or OUT
Indicates whether the parameter is an input parameter or an output parameter. IN OUT signals an input and output parameter.
cli_parameter_data_type
Name of the parameter data type.
The language-specific C and COBOL syntax of the individual CLI calls can be found in the section "SESAM CLI calls".
Corresponding data types
The table below shows the C and COBOL data types that correspond to SQL data types of CLI routines. The “Type” column indicates whether the parameter is an input parameter or an output parameter. The “Length” column specifies the length of values in bytes.
SQL data type | Type | COBOL data type | C data type | Length |
BOOLEAN | IN | PIC S9(p) with the | long int const * | 4 |
OUT | long int * | |||
INTEGER | IN | PIC S9(p) with the | long int const * | 4 |
OUT | long int * | |||
IN OUT | ||||
CHAR(n) | IN | PIC X(n) | char const * | n |
OUT | char * | |||
IN OUT | ||||
POINTER | IN | PIC X(n) | char * | 4 |
CHAR(ddd) | OUT | SQLda | SQLda_t * | ddd |
Table 55: Corresponding data types
The value “p” in the data type PIC S9(p) must be between 5 and 9.
The SYNCHRONIZED clause need not be specified in COBOL for arguments of CLI calls. The data type POINTER is used to transfer the address of a buffer, the length of which is defined in another parameter.
The COBOL data type SQLda
SQLda is a diagnostics area in SESAM/SQL. It is structured as follows in COBOL:
|
| ||||
|
|
|
|
| |
|
| ||||
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |
|
|
|
|
| |
|
|
|
| ||
|
| ||||
|
|
|
| ||
|
|
|
| ||
|
|
|
|
| |
|
|
|
| ||
|
|
|
|
| |
|
|
|
| ||
|
|
|
|
| |
|
|
|
|
SQLda
Diagnostics area for SESAM/SQL.
SQLda01, SQLda02, ... SQLda99
Reserved for internal purposes.
SQLerrline
In the event of an error, this variable contains the line number of the position in the text of a prepared statement at which the error occurred. If the source of the error cannot be determined or the specified position makes no sense, this is set to 0 (zero).
SQLerrcol
In the event of an error, this variable contains the column number of the position in the text of a prepared statement at which the error occurred. If the source of the error cannot be determined or the specified position makes no sense, this is set to 0 (zero).
SQLerrm
Following the execution of an SQL statement, this variable contains a message text if the SQL statement returned a value other than 00000 in SQLSTATE. This consists of the error class (W for WARNING or E for ERROR), the message number SQL nnnn and the message text itself.
SQLrowcount
Following the execution of the corresponding statements, this variable contains the following information:
in the case of an INSERT statement, the number of rows inserted
in the case of an UPDATE or DELETE statement with a search condition, the number of rows that satisfied the search condition
in the case of an UPDATE or DELETE statement without a WHERE clause, the number of rows in the referenced table
in the case of a MERGE statement, the sum of the number of updated and the number of inserted rows
in the case of an UNLOAD statement, the number of rows output
in the case of a LOAD statement, the number of rows newly loaded
in the case of an EXPORT statement, the number of rows copied to the export file
in the case of an IMPORT statement, the number of rows copied from the export file
In all other cases, the contents of this variable are not defined.
The C data type SQLda_t
The SQLda_t data type is the C equivalent of COBOL’s SQLda. The diagnostics area in C is structured as follows:
| |||
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
|
| |
|
The individual parameters are the same as those in the COBOL data type SQLda.