In the DBCAREA, the application supplies the session id and request id of the request from which data is to be fetched and sets the function code to DBFFET.
If the request was submitted with the Move Mode processing option, the application program must also supply the length of and a pointer to the response area in the DBCAREA. DBCHCL is then called to perform the fetch.
DBCHCL first determines whether options flags are to be taken from the RCB of the specified request or from the set options flag of the DBCAREA. If set options flag is Y, options are taken from the DBCAREA, otherwise the options in the RCB are used.
- Supplies the session and request identifiers for the specified request in the MTDPCB
- Constructs a continue request in the request buffer for the request by creating a Resp or KeepResp Parcel
- Sets the function code of the MTDPCB to MTDPCONT
- Calls MTDP
MTDP sends a Continue Request message to the database. It then returns control to DBCHCL.
- Supplies the session id and request id of the active request in the MTDPCB
- Sets the waitdata option flag according to the input options waitdata value
- Sets the function code to MTDPRET
- Calls MTDP
MTDP checks if the request has completed, and, if waitdata is TRUE, waits until the response message for the prior request arrives or an error occurs, and then returns control to DBCHCL.
If all prior calls to MTDP have returned successfully, DBCHCL checks for a buffer overflow; if one is found, the buffer is grown to accommodate the larger response, and the request is continued. DBCHCL makes the next unit of response available to the application program by locating the next parcel and returning it to the application either through a pointer into the response buffer, or, if Move Mode has been specified, by copying the parcel into the buffer provided by the application and pointed to be the data field of the DBCAREA.
If the return code or error flag in the DBCAREA are not normal, the application makes the appropriate changes, and re-submits the MTDP Control Block to DBCHCL, as above. Otherwise, it consumes the unit of response. Typically, the application loops back for another unit of response until the EndRequest parcel is obtained.