ct_exit

Description

Exits Client-Library.

Syntax

CS_RETCODE ct_exit (context, option);
CS_CONTEXT   *context
CS_INT       option;

Parameters

context

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

If this value is invalid or nonexistent, ct_exit fails.

option

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

ct_exit can behave in different ways, depending on the value specified for option. The following table lists the symbolic values that are legal for option:

OPTION value

ct_exit 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 on one or more connections, ct_exit 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

ct_exit 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 ct_exit. It is taken from the sample program SYCTSAA6 in Appendix A, “Sample Language Application.”

  	/********************************************************************/
  	/*                                                                  */
  	/* Subroutine to perform exit client library and deallocate context */
  	/* structure.                                                       */
  	/*                                                                  */
  	/********************************************************************/
  	void   quit_client_library ()
  {
   CS_INT        rc;
  /*------------------------------------------------------------------*/
  /* Exit the Client Library                                          */
  /*------------------------------------------------------------------*/
         rc = ct_exit (context, (long) CS_UNUSED);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_EXIT failed", msg_size);
            error_out(rc) ;
          }
  /*------------------------------------------------------------------*/
  /* De-allocate the context structure                                */
  /*------------------------------------------------------------------*/
         rc = cs_ctx_drop (context);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CTX_DROP failed", msg_size);
            error_out(rc) ;
         }
  
         EXEC CICS RETURN ;
  
  }   /* end quit_client_library */

Usage

See also

Related functions