Process Remote Extended Dynamic SQL (QxdaProcessExtDynEDRS) API


  Required Parameter Group:

1 Connection handle Input Binary(4)
2 SQL descriptor area Input Char(*)
3 SQL communications area Output Char(136)
4 QSQPRCED function template format Input Char(8)
5 QSQPRCED function template Input Char(*)
6 Receiver variable Output Char(*)
7 Length of receiver variable Input Binary(4)
8 Receiver variable format Input Char(8)
9 Additional options Input Binary(4)
10 Error code I/O Char(*)

  Service Program Name: QXDAEDRS

  Default Public Authority: *USE

  Threadsafe: Conditional; see Usage Notes

The Process Remote Extended Dynamic SQL (QxdaProcessExtDynEDRS) API is used to perform extended dynamic SQL operations on the database server system. The SQL operations are performed by the Process Extended Dynamic SQL (QSQPRCED) API.


Authorities and Locks

See the Process Extended Dynamic SQL (QSQPRCED) API documentation for authorities required.


Required Parameter Group

Connection handle
INPUT; BINARY(4)

The handle number of the connection on which to perform the extended dynamic SQL operation. The connection handle must have been generated by the QxdaConnectEDRS API in the current job and activation group.

SQL descriptor area
INPUT; CHAR(*)

Passes information about the variables being used on a specific SQL statement. The SQLDA is used for passing the address, data type, length, and CCSID for variables on an OPEN, EXECUTE, FETCH, or DESCRIBE function.

The format of the structure is standard and is described more completely in the SQL programming and DB2® for IBM® i SQL reference topic collections.

SQL communications area
OUTPUT; CHAR(136)

Returns diagnostic information. It includes the SQLCODE variable, indicating whether an error has occurred. If SQLCODE has a value of 0 after a call to this API, the function was successful.

The format of the structure is standard and is described more completely in the SQL programming and DB2 for i SQL reference topic collections.

QSQPRCED function template format
INPUT; CHAR(8)

The format of the function template being used. The formats of the QSQPRCED function templates are standard. For possible values and complete descriptions, see the Process Extended Dynamic SQL (QSQPRCED) API documentation. The SQLP0100, SQLP0110, SQLP0200, SQLP0210, and SQLP0500 QSQPRCED formats are not supported by the QxdaProcessExtDynEDRS API.

QSQPRCED function template
INPUT; CHAR(*)

Determines the function to perform, the requested statement to process, and the SQL package to be used. It also contains the text of the statement, which is required for the PREPARE function. For the format of this parameter, see the Process Extended Dynamic SQL (QSQPRCED) API documentation.

Receiver variable
OUTPUT; CHAR(*)

The structure in which to return information about the connection. For the format of this parameter, see EXDO0100 Format.

Length of receiver variable
INPUT; BINARY(4)

The number of bytes that the calling program provides for the receiver variable data.

Receiver variable format
INPUT; CHAR(8)

The format of the receiver variable template being used. The possible value is:

EXDO0100 Basic receiver variable

Additional options
INPUT; BINARY(4)

The following are valid options. The binary OR operation can be used to use more than one of these options together.

0x00000000 - 0 - QXDA_EXTDYN_NOOPTS
 
0x00000001 - 1 - QXDA_CREATE_OBJECTS
When preparing a statement into an SQL package, create the library and SQL package if they do not already exist. This option is valid only for QSQPRCED functions 2 and 9; it is ignored for all other functions. When this option is specified, all parameters required by the Process Extended Dynamic SQL (QSQPRCED) API for function 1 must be provided in the QSQPRCED function template.
0x00000010 - 16 - QXDA_FIND_STMT
If this option is specified and the statement name parameter of the QSQPRCED function template is blank, a search will be performed to see if there is already a prepared statement in the specified library and package with the same statement text as the current text. If not, a unique statement name will be generated and returned in the statement name field of the receiver variable.
0x00000100 - 256 - QXDA_DEFER_OPEN
Defer the open until a fetch is performed, when possible. The system will determine if the open can be deferred. This option is valid only for QSQPRCED function 4, and only when using a remote connection type. It is ignored in all other cases. It will cause a failure at fetch time if the fetch immediately following an open using this option is not from the same cursor as the open.
Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


EXDO0100 Format

The following table shows the information returned in the EXDO0100 format. For more details about the fields in this table, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 BINARY(4) Bytes returned
4 4 BINARY(4) Bytes available
8 8 CHAR(18) Statement name


Field Descriptions

Bytes available. The length of the information available to the API to return, in bytes.

Bytes returned. The actual number of bytes returned.

Statement name. The statement name generated when the QXDA_FIND_STMT option is specified.


Usage Notes

This function may be called from the initial thread of a job only.


Error Messages

Message ID Error Message Text
CPF180C E Function &1 not allowed.
CPF24B4 E Severe error while addressing parameter list.
CPF3C21 E Format name &1 is not valid.
CPF3C90 E Literal value cannot be changed.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPFAE14 E Cannot allocate &1 bytes.
CPFB750 E Connection handle specified not valid.
CPFB752 E Internal error in &1 API.
CPFB756 E Rollback operation performed.
CPFB757 E The connection is suspended.
CPFB758 E The EDRS server system has been switched.
CPFB759 E Cursor not valid for operation.



API introduced: V4R4

[ Back to top | Database and File APIs | APIs by category ]