CTBEXIT

Description

Exits Client-Library.

Syntax

%INCLUDE CTPUBLIC;
DCL
     01 CONTEXT      FIXED BIN(31) INIT(0);
     01 RETCODE     FIXED BIN(31) INIT(0);
     01 OPTION         FIXED BIN(31);
 
 CALL CTBEXIT (CONNECTION, RETCODE, OPTION); 

Parameters

CONTEXT

(I) A context structure. The context structure is defined in the program call CSBCTXALLOC. This value identifies the Client-Library context being exited.

If this value is invalid or nonexistent, CTBEXIT fails.

RETCODE

(O) Variable where the result from an executed function returns. Its value is one of the codes listed under “Returns,” in this section.

OPTION

(O) Indicator specifying whether or not CTBEXIT closes connections for which results are pending.

CTBEXIT behaves in differently, depending on the value specified for OPTION. The following table lists the symbolic values that are legal for OPTION.

OPTION value

CTBEXIT action

CS_UNUSED (-99999)

Closes all open connections for which no results are pending and terminates Client-Library for this context. If results are pending for one or more connections, CTBEXIT returns CS_FAIL and does not terminate Client-Library.

CS_FORCE_EXIT (300)

Closes all open connections for this context, whether or not any results are pending, and terminates Client-Library for this context.

Returns

CTBEXIT returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

TDS_INVALID_PARAMETER (-4)

A parameter contains an illegal value.

TDS_RESULTS_STILL_ACTIVE (-50)

Some results are still pending.

TDS_ CONNECTION_ TERMINATED (-4997)

The connection is not active.

TDS_WRONG_STATE (-6)

Program is in the wrong communication state to issue this call.

Examples

Example 1

The following code fragment demonstrates the use of CTBEXIT. It is taken from the sample program SYCTSAA4 in Appendix A, “Sample Language Application.”

/*------------------------------------------------------------------*/
 	/*                                                                  */
 	/* Subroutine to perform exit client library and deallocate context */
 	/* structure.                                                       */
 	/*                                                                  */
 	/*------------------------------------------------------------------*/
 	QUIT_CLIENT_LIBRARY: PROC ;
 
 	/*------------------------------------------------------------------*/
 	/* exit the Client Library                                          */
 	/*------------------------------------------------------------------*/
          CALL CTBEXIT( CSL_CTX_HANDLE,
                       CSL_RC,
                       CS_UNUSED ) ;
          IF CSL_RC = CS_FAIL THEN
         DO ;
           MSGSTR = 'CTBEXIT failed' ;
           CALL ERROR_OUT ;
         END ;
	/*------------------------------------------------------------------*/
 	/* de-allocate the context stricture                                */
 	/*------------------------------------------------------------------*/
		 CALL CSBCTXDR( CSL_CTX_HANDLE,
                        CSL_RC ) ;
         IF CSL_RC = CS_FAIL THEN
         DO ;
           MSGSTR = 'CSBCTXDROP failed' ;
           CALL ERROR_OUT ;
         END ;
EXEC CICS RETURN ;
		 END QUIT_CLIENT_LIBRARY ;

Usage

See also

Related functions: