15.10 - Fetching the Response for a Request - Call-Level Interface Version 2

Teradata Call-Level Interface Version 2 Reference for Mainframe-Attached Systems

Call-Level Interface Version 2
Programming Reference

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:

1 Modify the DBCAREA.

a Set the Function to Fetch.

b Set the Input CLIv2 Session Id used to initiate the request.

c Set the Input CLIv2 Request Id to the Output CLIv2 Request Id obtained when the request was initiated.

d Optionally set the following:

  • Positioning‑action
  • Positioning‑statement‑number
  • Positioning‑value
  • Fetch Maximum Data Length
  • Fetch Data Pointer
  • Message Area Pointer
  • Message Area Length
  • 2 Call DBCHCL to perform the Fetch function.

    3 Check the return code from DBCHCL.


    Return Code



    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 Chapter 3: “DBCAREA,” and under the heading “Fetch Function” in Chapter 6: “Common Routines.”

    anything else

    Process the return code and DBCAREA message.

    The first fetch returns the following:

  • 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.