16.20 - DBCHCLN - Teradata Tools and Utilities

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

Teradata Tools and Utilities
September 2019
Programming Reference


Logs off all sessions and free all internal memory and context information allocated by CLIv2.

The alternate six-character name for DBCHCLN is DBCHCN.


This routine is called with the following parameters, stylistically presented (the actual syntax varies according to the programming language being used):


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

  • The application invokes the DBCHCLN routine when all processing requiring interfacing with the Teradata Database is complete.
  • DBCHCLN does the following:
    • logs off any idle sessions
    • awaits completion of any active sessions and then logs them off
    • frees all internal memory and context information allocated by CLIv2.
  • DBCHCLN deallocates internal data structures that were allocated by DBCHINI.
  • DBCHCLN returns control to the application after all sessions have been logged off and all internal context has been cleaned up.
  • After control returns from DBCHCLN, the variable contains a code whose value represents success or failure to clean up.

    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.

  • After the call, CLIv2 changes ContextArea for its own purposes.
  • The call to DBCHCLN does not deallocate the DBCAREA.

    The application may itself deallocate the DBCAREA if the programming language provides that ability.

  • Termination of the application has the same effect as DBCHCLN, but it is good programming practice to call DBCHCLN for cleanup.