The following information applies if the application chose single-buffering when initiating the request and sets keep-response to 'Y', and is now choosing to rewind the response and review it.
- Supplies the session id and request id of the response required
- Supplies the length of and a pointer to the response area, if the request was submitted with the Move Mode processing option
- Sets the function code to Rewind and Fetch (DBFREW)
- Calls DBCHCL
- The RCB for the active request is located
- The waitdata options flag for the request is passed to MTDP in the MTDPCB along with the session and request identifiers
- MTDP is called to check for or wait for completion of the request
If the request did not complete successfully an error message is returned to the application.
If the current response buffer is the first buffer for the request, the buffer pointer is reset to the top of the buffer and DBCHCL returns successfully to the application. If KeepResp had not been specified for the request and the response buffer contains an EndRequest parcel, DBCHCL returns with a message indicating it cannot rewind the response. Otherwise, DBCHCL places a Rewind parcel and either a KeepResp or Resp parcel (depending on the KeepResp processing option value) in the request buffer for the request, supplies the session id and request id of the specified request in the MTDPCB, sets the MTDPCB function code to MTDPCONT, and calls MTDP.
MTDP sends a Continue Request message to the database. It then returns control to DBCHCL.
A success or error message is generated in the message field of the DBCAREA and DBCHCL returns to the application.
If the return code or error flag in the DBCAREA are not normal, the application makes the appropriate changes, and re-submits the DBCAREA to DBCHCL, as above. Otherwise, it performs a fetch as for the no-rewind case and consumes the unit of response. Typically, the application loops back for another unit of response until the EndRequest parcel is obtained.