Explicitly Establishing a Session - Call-Level Interface Version 2

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

Product
Call-Level Interface Version 2
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
dita:id
B035-2417
lifecycle
previous
Product Category
Teradata Tools and Utilities

Explicitly Establishing a Session

Before Teradata Database can process requests, one or more sessions must be established on a server. If a large number of sessions need to be simultaneously connected by an application, the DBCISMAX setting should reflect this when the first session is connected. Doing so will improve performance by allowing CLIv2 to optimize its internal processing. To establish a session, an application must perform the following

1 Modify the DBCAREA.

a Set the Function to CONNECT.

b Optionally, set the following:

  • Mechanism‑name
  • As required by that name, sets the following:
  • - Mechanism‑data‑len

    - Mechanism‑data‑ptr

    - Mechanism‑data‑encoding

    - Delegate‑user‑identity

    c If required, set the Logon Pointer.

    d If required, set the Logon Length.

    e Optionally set the following:

  • Request Buffer Length
  • Request‑parcel‑format
  • Response Buffer Length
  • Anticipated Number of Concurrent Sessions
  • Request‑token
  • Input TDPpath
  • Run Pointer
  • Run Length
  • Message Area Pointer
  • Message Area Length
  • Session‑desc‑pointer
  • Session‑desc‑length
  • Workload‑pointer
  • Workload‑length
  • Any option values required
  • 2 Call DBCHCL to perform the Connect function.

    3 Check the return code from DBCHCL.

  • If the return code is anything but 0:
  • Process the return code and DBCAREA message.
  • Call DBCHCL to perform the Disconnect function (see “Terminating a Session” on page 62).
  • If the return code is 0, call DBCHCL to perform a Fetch function (see “Fetching the Response for a Request” on page 58) to get the final status of the connect request:
  •  

    Connect Type

    Return Code

    Result

    R

    33

    A session is established and the Teradata SQL processing can continue.

    0

    Process the failure/error parcels.

    anything else

    An abnormal situation occurred. Use the Fetch function (“Fetching the Response for a Request” on page 58) to process.

    C

    0

    Process parcels from Teradata Database.

    If a success parcel returns, then a session is established and Teradata SQL processing can continue.

    If anything else returns, process the failure/error parcel.

    anything else

    An abnormal situation occurred. Use the Fetch function (“Fetching the Response for a Request” on page 58) to process.

    4 Call DBCHCL to perform the End Request function (see “Ending a Request” on page 61).

    If the Connect attempt is not successful at any point, the program can retry the Connect after calling DBCHCL for the End Request function.

    If the application requires multiple active requests, multiple sessions can be established by following the aforementioned steps for each session desired.

    In addition, the Session Id field in the DBCAREA should be saved to request Teradata SQL processing for that session at a later time.