Summary of CLIv2 Routine Parameters
The following table lists the parameters for the routines in this chapter
Routine |
Parameters |
DBCHINI |
ReturnCode Address ContextArea Address DBCAREA Address |
DBCHCL |
ReturnCode Address ContextArea Address DBCAREA Address |
DBCHCLN |
ReturnCode Address ContextArea Address |
DBCHINI
Purpose
Sets up the CLIv2 environment.
The application must provide the DBCAREA and then call DBCHINI to initialize it.
Note: The alternate six-character name for DBCHINI is DBCHIN.
Interface
This routine is called with the following parameters, stylistically presented (the actual syntax varies according to the programming language being used):
DBCHINI(ReturnCode,ContextArea,DBCAREA)
In high-level languages, the details of the parameter list are handled by the compiler. For Assembler, the parameter list consists of contiguous 4 byte entries, each containing the 31 bit address of a parameter. The last address has the first bit set to one to indicate the end of the list.
The parameters for this routine are:
Argument |
Content |
ReturnCode |
A 4 byte unsigned integer field into which the return code will be placed by CLIv2. |
ContextArea |
A 4 byte unsigned integer field for internal use by CLIv2. |
DBCAREA |
The DBCAREA structure. |
Usage Notes
DBCHCL
Purpose
Calls the functions to be used by the application.
An overview of the functions relative to DBCHCL is given in the first table in the section “Summary of CLIv2 Routine Parameters” on page 249. Each function is described in detail later in this chapter.
Process
Before each call to DBCHCL, the application modifies the DBCAREA to specify the action requested and to fill in the input fields relevant to that action. DBCHCL carries out the function specified by the function code in the DBCAREA, then passes back to the caller the DBCAREA, which contains, among other things, a return code. The application checks the return code in the DBCAREA, which is where CLIv2 and TDP indicate any problem they find.
If the call results in a delivery of parcels to the response buffer, the program checks the first parcel, which may be one of the following:
Interface
This routine is called with the following parameters, stylistically presented (the actual syntax varies according to the programming language being used):
DBCHCL(ReturnCode,ContextArea,DBCAREA)
In high-level languages, the details of the parameter list are handled by the compiler. For Assembler, the parameter list consists of contiguous 4 byte entries, each containing the 31 bit address of a parameter. The last address has the first bit set to one to indicate the end of the list.
The parameters for this routine are:
Argument |
Content |
ReturnCode |
A 4 byte unsigned integer field into which the return code will be placed by CLIv2. |
ContextArea |
A 4 byte unsigned integer field for internal use by CLIv2. |
DBCAREA |
The DBCAREA structure. |
Usage Notes
DBCHCL Functions
This section describes the DBCHCL functions listed below.
Function Name |
Description |
CON |
Connect |
RSUP |
RunStartUp Request |
IRQ |
Initiate Request |
IWPF |
Initiate With Protocol‑Function |
CRQ |
Continue Request |
CMD |
Command |
ABT |
Abort |
FET |
Fetch |
REW |
Rewind and Fetch |
ERQ |
End Request |
DSC |
Disconnect |
General Notes
For each function, there is a list of the required and optional input and output arguments and a general description of how DBCHCL processes the function.
The interpretation of some of the arguments may depend on the setting of the DBCAREA options (for more information, see “Setting DBCAREA Options” on page 46.
For instance, input/output string pointers may be variable strings. For output strings, DBCHCL will provide an address and length if Locate mode is in effect; otherwise, DBCHCL expects that the application has set the address of the area to which DBCHCL is to move the string.
If DBCHCL detects an error while processing, various fields will be set to help the user interpret and handle the error.
DBCHCL CON Function
Purpose
CON (Connect) logs on to the Teradata Database and arranges to have the specified services available for all requests on that session.
Connect also allocates internal control structures that CLIv2 uses to store session context.
Usage Notes
For a discussion of the call and the fields used, see “DBCHCL FET Function” on page 273.
DBCAREA Input Fields
Before using the Connect function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Optional for the Connect Function |
|
2PC |
Anticipated Number of Concurrent Sessions |
Automatic‑redrive |
Change Options |
Character Set Pointer |
Connect Type |
Country Id |
C2S Conversion |
Data‑encryption |
Date Form |
Delegate‑user‑identity |
Extended‑load |
Input TDP Path |
Keep Response |
Language Conformance |
Language Id |
Locate Mode |
Logon Length |
Logon Pointer |
Maximum Parcel |
Mechanism‑data‑encoding |
Mechanism‑data‑len |
Mechanism‑data‑ptr |
Mechanism‑name |
Message Area Pointer |
Message Area Length |
Parcel Mode |
Request Buffer Length |
Request Mode |
Request‑parcel‑format |
Request Processing Option |
Request‑token |
Response Buffer Length |
Response Mode |
Return Time |
Run Length |
Run Pointer |
Save Response Buffer |
Session‑desc‑length |
Session‑desc‑pointer |
Set Character Set |
Statement‑status |
S2C Conversion |
Tell‑if‑delay |
Transaction Semantics |
Two Response Buffers |
Use‑default‑conn |
Use Presence Bits |
Utility‑workload |
Variable Length Fetch |
Variable Length Request |
Wait‑during‑delay |
Wait‑exclusion |
Wait For Response |
Workload‑length |
Workload‑pointer |
DBCAREA Output Fields
Upon completion of the Connect function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields Always Set for the Connect Functions |
|
Message Return Code |
Message Length |
Message Text |
Message Text Length |
Current Response Buffer Length |
Output CLIv2 Request Id |
Output CLIv2 Connection Id |
Return Code |
DBCAREA Output Fields Set by Successful Connect Functions |
|
Current Request Buffer Length |
Mechanism‑name |
Open Requests |
Session Status |
TDP Request Number |
|
DBCHCL RSUP Function
Purpose
RSUP (RunStartUp) sends a request to the Teradata Database to execute the startup request stored on the Teradata Database.
Usage Notes
DBCAREA Input Fields
Before using the Run Start‑up function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the RunStartup Function |
|
Function |
Input CLIv2 Connection Id |
DBCAREA Output Fields Optional for the RunStartup Function |
|
Anticipated Number of Concurrent Sessions |
APH‑response‑OK |
Array‑Transforms‑Off |
Change Options |
Column‑info |
C2S Conversion |
Continued‑character‑state |
Data‑encryption |
Input TDP Path |
Keep Response |
Locate Mode |
Logon Length |
Logon Pointer |
Max‑decimal‑returned |
Maximum Parcel |
Multi‑statement‑errors |
Parcel Mode |
Period‑as‑Struct |
Refresh‑cached‑data |
Request Buffer Length |
Request‑parcel‑format |
Request Processing Option |
Request‑token |
Response Buffer Length |
Response Mode |
Return Time |
Return‑identity‑data |
Result‑sets‑OK |
Return‑result‑to |
Return‑statement‑info |
Row‑count |
Run Length |
Run Pointer |
Save Response Buffer |
S2C Conversion |
Tell‑if‑delay |
Transforms‑off |
Trusted‑request |
Two Response Buffers |
Use Presence Bits |
Variable Length Request |
Variable Length Fetch |
Wait‑during‑delay |
Wait‑exclusion |
Wait For Response |
XML‑response‑format |
DBCAREA Output Fields
Upon completion of the Run Start‑up function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields Always Set by the RunStartup Function |
|
Current Response Buffer Length |
Message Return Code |
Message Text |
Message Text Length |
Output CLIv2 Request Id |
Return Code |
DBCAREA Output Fields Set by Successful RunStartup Functions |
|
Current Request Buffer Length |
Message Return Code |
Message Text |
Message Text Length |
Open Requests |
TDP Request Number |
DBCHCL IRQ Function
Purpose
IRQ (Initiate Request) sends a request to the Teradata Database to be processed.
Usage Notes
DBCAREA Input Fields
Before using the Initiate Request function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Initiate Request Function |
|
Function |
Input CLIv2 Connection Id |
Request Length |
Request Pointer |
DBCAREA Input Fields Optional for the Initiate Request Function |
|
Anticipated Number of Concurrent Sessions |
APH‑response‑OK |
Array‑Transforms‑Off |
Change Options |
Character Set |
C2S Conversion |
Column‑info |
Continued‑character‑state |
Data‑encryption |
Extension Pointer |
Input TDP Path |
Keep Response |
Locate Mode |
Logon Length |
Logon Pointer |
Max‑decimal‑returned |
Maximum Parcel |
Message Area Length |
Message Area Pointer |
Multi‑statement‑errors |
Parcel Mode |
Period‑as‑Struct |
Pointer |
Refresh‑cached‑data |
Request Buffer Length |
Request Mode |
Request‑parcel‑format |
Request Processing Option |
Request‑token |
Response Buffer Length |
Response Mode |
Result‑sets‑OK |
Return‑identity‑data |
Return‑result‑to |
Return‑statement‑info |
Return Time |
Row‑count |
Run Length |
Run Pointer |
Save Response Buffer |
Session Id |
Set Character Set |
Statement‑status |
S2C Conversion |
Tell‑if‑delay |
Transforms‑off |
Trusted‑request |
Two Response Buffers |
Using Data Pointer |
Using Data Length |
Use Presence Bits |
Variable Length Fetch |
Variable Length Request |
Wait‑during‑delay |
Wait‑exclusion |
Wait For Response |
XML‑response‑format |
|
DBCAREA Output Fields
Upon completion of the Initiate Request function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Initiate Request Function |
|
Current Response Buffer Length |
Message Return Code |
Message Text |
Message Text Length |
Output CLIv2 Request Id |
Return Code |
DBCAREA Output Fields set by Successful Initiate Request Functions |
|
Current Request Buffer Length |
Open Requests |
TDP Request Number |
|
DBCHCL IWPF Function
Purpose
IWPF (Initiate with Protocol‑Function) enables an application to send a request to the Teradata Database.
It contains additional protocol functions for 2PC sessions, for use in specialized applications.
Note: This function can not be used when ANSI transaction semantics are enabled.
Usage Notes
Code |
Meaning |
N |
No protocol function. This is the default. |
V |
Vote protocol function to be appended. |
T |
Vote & Terminate protocol function to be appended. |
DBCAREA Input Fields
Before using the Initiate With Protocol‑function function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Initiate With Protocol‑function Function |
|
Function |
Input CLIv2 Connection Id |
Request Length |
Request Pointer |
DBCAREA Input Fields Optional for the Initiate With Protocol‑function Function |
|
Anticipated Number of Concurrent Sessions |
APH‑response‑OK |
Array‑Transforms‑Off |
Change Options |
Character Set |
C2S Conversion |
Column‑info |
Continued‑character‑state |
Extension Pointer |
Input TDP Path |
Keep Response |
Length |
Logon Length |
Logon Pointer |
Max‑decimal‑returned |
Maximum Parcel |
Message Area Length |
Message Area Pointer |
Multi‑statement‑errors |
Parcel Mode |
Period‑as‑Struct |
Pointer |
Protocol Function |
Refresh‑cached‑data |
Request Buffer Length |
Request Mode |
Request‑parcel‑format |
Request Processing Option |
Request‑token |
Response Buffer |
Response Mode |
Result‑sets‑OK |
Return‑identity‑data |
Return‑result‑to |
Return‑statement‑info |
Return Time |
Row‑count |
Run Length |
Run Pointer |
Save Response Buffer |
Session Id |
Set Character Set |
Statement‑status |
S2C Conversion |
Tell‑if‑delay |
Transforms‑off |
Trusted‑request |
Two Response Buffers |
Using Data Length |
Using Data Pointer |
Use Presence Bits |
Variable Length Fetch |
Variable Length Request |
Wait‑during‑delay |
Wait‑exclusion |
Wait For Response |
XML‑response‑format |
|
DBCAREA Output Fields
Upon completion of the Initiate With Protocol‑function function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Initiate With Protocol‑function Function |
|
Message Return Code |
Current Response Buffer Length |
Message Length |
Message Text |
Message Text Length |
Output CLIv2 Request Id |
Return Code |
|
DBCAREA Output Fields set by Successful Initiate With Protocol‑function Functions |
|
Current Request Buffer Length |
Open Requests |
TDP Request Number |
|
DBCHCL CRQ Function
Purpose
CRQ (Continue Request) sends data requested by the Teradata Database to complete an SQL request. The need for such completion must be indicated by one of the following SQL requests:
When either parcel is received, the application then sends data to complete the SQL request using the ContinueRequest function.
Usage Notes
The application should call the CRQ function after processing an ElicitData or ElicitFile response parcel. If return Code is zero, the application must invoke the FET function to process the response. If more data exists, these steps are repeated as many times as necessary.
DBCAREA Input Fields
Before using the Continue Request function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Continue Request Function |
|
Continued‑data |
Function |
Input CLIv2 Connection Id |
Input CLIv2 Request Id |
Request Length |
Request Pointer |
When processing an ElicitData parcel, the Request‑pointer addresses data for the Large Object (LOB). The LOB begins with an 8‑byte unsigned integer that contains the length, in bytes, of the data. If the length is not known when the start of the LOB is sent, the length field might be zero.
When processing an executable item, the Request‑pointer addresses its statements, which do not begin with a length field.
DBCAREA Input Fields Optional for the Continue Request Function |
|
Change Options |
C2S Conversion |
Fetch Buffer Length |
Locate Mode |
Maximum Parcel |
Message Area Length |
Message Area Pointer |
|
DBCAREA Output Fields
Upon completion of the Continue Request function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Continue Request Function |
|
Message Length |
Message Return Code |
Message Return Code |
Message Text |
Message Text Length |
Message Return Code |
Return Code |
|
DBCAREA Output Fields set by Successful Continue Request Functions |
|
Current Request Buffer Length |
Current Response Buffer Length |
DBCHCL CMD Function
Purpose
CMD (Command) issues a TDP command within a CLIv2 program.
This function is used to send the TDP command, specifying a buffer and length that contain the command text.
Usage Notes
To process the response, issue a FETch function with the returned pseudo‑connection number and request number.
The response data is composed of various parcels in the following order:
1 A Success parcel with an activity count that indicates the number of subsequent Record parcels
2 The Record parcels themselves (one Record parcel for each line of command output)
3 An End Statement parcel
4 An End Request parcel
Since the application doesn‘t establish a connection, no DISCONN function may be used for the pseudo‑connection number. Rewind and Abort functions are not supported.
If the specified response buffer is too small for the entire response, a code of 535 is returned, either as a warning code in the Success parcel or as a return code from the CLIv2 call.
DBCAREA Input Fields
Before using the Command function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Command Function |
|
Function |
|
DBCAREA Input Fields Optional for the Command Function |
|
Anticipated Number of Concurrent Sessions |
Change Options |
Character Set |
Input TDP Path |
Length |
Locate Mode |
Maximum Parcel |
Message Area Length |
Message Area Pointer |
Parcel Mode |
Pointer |
Request Buffer |
Request Length |
Request Mode |
Request Pointer |
Request Processing Option |
Response Buffer Length |
Response Mode |
Return Time |
Set Character Set |
Tell‑if‑delay |
Request‑token |
Two Response Buffers |
Use Presence Bits |
Variable Length Fetch |
Variable Length Request |
Wait‑during‑delay |
Wait‑exclusion |
Wait For Response |
|
DBCAREA Output Fields
Upon completion of the Command function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Command Function |
|
Current Response Buffer Length |
Message Length |
Message Return Code |
Message Text |
Message Text Length |
Output CLIv2 Request Id |
Output CLIv2 Connection Id |
Return Code |
DBCAREA Output Fields set by Successful Command Functions |
|
Current Request Buffer Length |
Open Requests |
TDP Request Number |
|
DBCHCL ABT Function
Purpose
ABT (Abort) attempts to abort a request and the transaction in which it is embedded. This is known as an asynchronous abort.
Abort may be used within an External Stored Procedure to indicate that the results of a request initiated with the DBCAREA Return‑result‑to option will not be reflected to the CALLer or the application.
Usage Notes
DBCAREA Input Fields
Before using the Abort function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Abort Function |
|
Function |
Input CLIv2 Request Id |
Input CLIv2 Connection Id |
|
DBCAREA Input Fields Optional for the Abort Function |
|
Message Area Length |
Message Area Pointer |
DBCAREA Output Fields
Upon completion of the Abort function, CLIv2 will always set DBCAREA fields in the table.
DBCAREA Output Fields always set by the Abort Function |
|
Message Return Code |
Message Length |
Message Text |
Message Text Length |
Return Code |
|
DBCHCL FET Function
Purpose
FET (Fetch) delivers a pointer to the next parcel of the response.
Usage Notes
DBCAREA Input Fields
Before using the Fetch function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Fetch Function |
|
Function |
Input CLIv2 Connection Id |
Input CLIv2 Request Id |
|
DBCAREA Input Fields Optional for the Fetch Function |
|
Fetch Data Pointer |
Fetch Maximum Data Length |
Message Area Length |
Message Area Pointer |
Positioning‑action |
Positioning‑statement‑number |
Positioning‑value |
Row‑count |
DBCAREA Output Fields
Upon completion of the Fetch function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Fetch Function |
|
Current Response |
Return Code |
Session Status |
Message Length |
Message Return Code |
Message Text |
DBCAREA Output Fields set by Successful Fetch Functions |
|
Buffer Length |
Data Length |
Fetch Data Pointer |
Fetch Parcel Flavor |
Fetch Returned |
Message Text Length |
Output TDP |
Output Host Id |
TDP‑receipt‑timestamp |
Time1 |
Time1‑status |
Time2 |
Time2‑status |
Time3 |
Time3‑status |
Time4 |
Time4‑status |
Time5 |
Time5‑status |
|
DBCHCL ERQ Function
Purpose
ERQ (End Request) explicitly closes a request, discard its response, and deallocated internal data structures related to the request.
Usage Notes
DBCAREA Input Fields
Before using the End Request function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the EndRequest Function |
|
Function |
Input CLIv2 Request Id |
Input CLIv2 Connection Id |
|
DBCAREA Input Fields Optional for the EndRequest Functions |
|
Message Area Length |
Message Area Pointer |
DBCAREA Output Fields
Upon completion of the End Request function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields Always Set for the EndRequest Function |
|
Message Text |
Message Length |
Message Text Length |
Return Code |
DBCAREA Output Fields Set by Successful EndRequest Functions |
|
Open Requests |
Message Return Code |
DBCHCL REW Function
Purpose
REW (Rewind) repositions to the beginning of the response from the Teradata Database.
Keep Response must have been set to Y at the time of the Initiate Request for the request. Since Keep‑response does not apply to Connect requests, the response to a Connect cannot be rewound.
Usage Notes
If Return Code is 0, the application may use FET to process the response.
DBCAREA Input Fields
Before using the Rewind function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Rewind Function |
|
Function |
Input CLIv2 Request Id |
Input CLIv2 Connection Id |
|
DBCAREA Input Fields Optional for the Rewind Function |
|
Message Area Length |
Message Area Pointer |
DBCAREA Output Fields
Upon completion of the End Request function, CLIv2 will always set DBCAREA fields in the first table and will set those in the second table if the function was successful.
DBCAREA Output Fields always set by the Rewind Function |
|
Message Return Code |
Message Text |
Message Length |
Message Text Length |
Return Code |
|
DBCHCL DSC Function
Purpose
DSC (Disconnect) logs a session off the Teradata Database.
Usage Notes
DBCAREA Input Fields
Before using the Disconnect function, the application must set the DBCAREA fields in the first table and may optionally set those in the second table depending on the application's requirements.
DBCAREA Input Fields Required for the Disconnect Function |
|
Function |
Input CLIv2 Connection Id |
DBCAREA Input Fields Optional for the Disconnect Function |
|
Message Area Length |
Message Area Pointer |
DBCAREA Output Fields
Upon completion of the End Request function, CLIv2 will always set DBCAREA fields in the table.
DBCAREA Output Fields always set by the Disconnect Function |
|
Message Return Code |
Message Length |
Message Text |
Message Text Length |
DBCHCLN
Purpose
Logs off all sessions and free all internal memory and context information allocated by CLIv2.
Note: The alternate six-character name for DBCHCLN is DBCHCN.
Interface
This routine is called with the following parameters, stylistically presented (the actual syntax varies according to the programming language being used):
DBCHCLN(ReturnCode,ContextArea)
In high-level languages, the details of the parameter list are handled by the compiler. For Assembler, the parameter list consists of contiguous 4 byte entries, each containing the 31 bit address of a parameter. The last address has the first bit set to one to indicate the end of the list.
The parameters for this routine are:
Argument |
Content |
ReturnCode |
A 4 byte unsigned integer field into which the return code will be placed by CLIv2. |
ContextArea |
A 4 byte unsigned integer field for internal use by CLIv2. |
Usage Notes
A return code of zero indicates success.
A nonzero return code indicates failure, and the value specifies the reason for the failure.
After the call, the return code variable will contain a return code.
The application may itself deallocate the DBCAREA if the programming language provides that ability.