To invoke a previously compiled and saved procedure, an SQL CALL statement is sent to the Database. When called, the procedure that was defined with the SQL READS SQL DATA or WRITES SQL DATA clause may itself invoke CLIv2 to establish a connection and send SQL requests. Such a connection may either be a new connection (a DBCAREA Use‑default‑conn value of 'N'), for which a standard Database logon string would be supplied, or the connection could use the same session used to CALL the procedure (a DBCAREA Use‑default‑conn value of 'Y').
The latter is known as the default connection, and has some limitations. Specifically, the character set used when the procedure is executed is the character set established when the procedure is created or replaced, not the character set being used when the CALL is sent. No capability is provided for the procedure to ascertain this character set.
Also, the following options established by the application cannot be changed:
No capability is provided for the procedure to ascertain the application's setting for these options. Also, the default connection may not be disconnected.
The procedure may use the DBCAREA Return‑result‑to option to provide CLIv2 the same information that would be provided by the WITH RETURN clause on the SQL PROCEDURE statement for an SQL Stored Procedure. Specifically, whether the results for an SQL request are returned to the requester, the caller of the procedure, or the application. If propagated to the caller or application, the parcels are preceded by a ResultSet response parcel.