The final status and any response information for a request are obtained by the Fetch function. To fetch the final status and any response after the session is established, an application must perform the following steps:
- Modify the DBCAREA.
- Set the Function to Fetch.
- Set the Input CLIv2 Session Id used to initiate the request.
- Set the Input-CLIv2-request-number to the Output-CLIv2-request-number obtained when the request was initiated.
- Optionally set the following:
Positioning-action
Positioning-statement-number
Positioning-value
Fetch-maximum-data-length
Fetch-data-pointer
Message-area-pointer
Message-area-length
- Call DBCHCL to perform the Fetch function.
- Check the return code from DBCHCL.
Return Code Results 0 Process the parcels.
This step depends on the setting of the options when the request was initiated and any changes from an Initiate Request, Initiate With Protocol-function, or RunStartUp function.
The first fetch returns the outcome of the request (ok, success, failure, or error).
The effect of the option switches on fetch processing may be found in the descriptions of the options in DBCAREA and under the heading “Fetch Function” in Common Routines.
anything else Process the return code and DBCAREA message.
- If any statement in the request causes an implicit rollback to occur, a failure parcel for the entire request is returned.
- If no implicit rollback happened, the ok, success, or error parcel information returned pertains to the first (or only) statement of the submitted request.