To send LOB data using the deferred method, a typical parcel mode CLI application should perform the following tasks:
- Set the response mode (resp_mode) to 'M' to indicate Multipart Indicator response mode. Any other setting will result in an error condition being returned.
- Place a unique four-byte integer token in those fields that would normally contain LOB data.
- The USING clause that references the LOB data types must specify AS DEFERRED.
- Issue the SQL request (typically including one or more INSERTs, UPDATEs, or UPSERTs) using DBCHCL (DBFIRQ).
- After the request completes, retrieve the response from the server using DBCHCL (DBFFET). After the request has been submitted to the server, the server will respond to the request with an ElicitData parcel. The ElicitData parcel will contain the token of the LOB that was placed in the MultipartData or MultipartIndicData parcel. The application will receive the ElicitData parcel containing the token that indicates which LOB parameter to send.
- The application may send as much data as can be fit into the MultipartData parcel.
- Issue DBCHCL (DBFCRQ) to send the deferred LOB data to the server with continuation_code populated appropriately.
- Retrieve the ElicitDataReceived parcel response from the server using DBCHCL (DBFFET).
- Repeat starting at step 7 each time an ElicitDataReceived parcel for the current LOB is received until there is no more data to send.
- Repeat starting at step 6 each time an ElicitData parcel with a different token is received. After all the LOBs have been successfully processed, the server will respond with a Success parcel.
- Issue DBCHCL (DBFERQ) to close the request.
The entire sequence outlined above constitutes a single, discrete request with one request number for the life of the transaction.