17.10 - Fetch Returned Data Length - Call-Level Interface Version 2

Teradata® Call-Level Interface Version 2 Reference for Workstation-Attached Systems

Product
Call-Level Interface Version 2
Release Number
17.10
Release Date
October 2021
Content Type
Programming Reference
Publication ID
B035-2418-061K
Language
English (United States)

Usage Notes

The Fetch Returned Data Length field specifies the length in bytes of the returned data.

Language Variable Name
COBOL: DBCAREA-FET-RET-DATA-LEN
C: DBCAREA.H: fet_ret_data_len
Routine Action Taken
DBCHINI: writes
DBCHCL: writes (FET)
Used by Action Taken
application program reads

After a call to DBCHCL for the Fetch function, the application program can obtain the length of the returned data.

Where the length is provided and what the length refers to depends on the settings in effect when DBCHCL is called for the Connect, Run Startup, or Initiate Request function:
  • If Locate Mode was set to N and Parcel Mode Fetch was set to Y and
    • If Variable Length Fetch was set to N,

      then, the length is in Fetch Returned Data Length; length is the length of the parcel body

    • If Variable Length Fetch was set to Y,

      then, the length is in first two bytes at address given in Fetch Data Pointer; length is the length of the parcel body

  • If Locate Mode was set to N and Parcel Mode Fetch was set to N and
    • if Variable Length Fetch was set to N, then the length is in Fetch Returned Data Length; length is the length of the buffer copied into fet_data_ptr by CLI.
    • if Variable Length Fetch was set to Y, then there is an error
(this last option is not allowed).
  • If Locate Mode was set to Y and Parcel Mode Fetch was set to Y and
    • If Variable Length Fetch was set to N,

      then, the length is in Fetch Returned Data Length; length is the length of the parcel body

    • If Variable Length Fetch was set to Y,

      then, the length is in first two bytes at address given in Fetch Data Pointer; length is the length of the parcel body

  • If Locate Mode was set to Y and Parcel Mode Fetch was set to N and
    • If Variable Length Fetch was set to N,

      then, the length is in Fetch Returned Data Length; length refers to the grand total of all parcels (headers and bodies) in the response buffer

    • If Variable Length Fetch was set to Y,

      then, there is an error (this last option is not allowed).

In Move Mode only the length number of bytes are affected in the Move area. The bytes beyond are left “as is.”

DBCHCL places Fetch Returned Data Length, if used, in the DBCAREA when the Fetch function completes. Thus Fetch Data Pointer is available when the application program regains control with return code of zero from a call to DBCHCL for the Fetch function.