cs_ctx_drop

Description

Deallocates a context structure.

Syntax

CS_RETCODE cs_ctx_drop(context);
cs_context   *context;

Parameters

context

(I) A pointer to a context structure.

Returns

cs_ctx_drop returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

The most common cause for a cs_ctx_drop failure is that the context contains an open connection.

Examples

Example 1

The following code fragment demonstrates how to use cs_ctx_drop with other functions at the end of a program to close the connection and return to CICS. It is taken from the sample program SYCTSAA6 in Appendix A, “Sample Language Application.”

  	/********************************************************************/
  	/*                                                                  */
  	/* Subroutine to perform drop command handler, close server         */
  	/* connection, and deallocate Connection Handler.                   */
  	/*                                                                  */
  	/********************************************************************/
  	void   close_connection ()
  
  	{
   	CS_INT        rc;
  
  	/*------------------------------------------------------------------*/
  	/* drop the command handle                                          */
  	/*------------------------------------------------------------------*/
  
         rc = ct_cmd_drop (cmd);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CMD_DROP failed", msg_size);
            error_out (rc) ;
         }
  

  /*------------------------------------------------------------------*/
  /* close the server connection                                      */
  /*------------------------------------------------------------------*/
  
         rc = ct_close (connection, (long) CS_UNUSED);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CLOSE failed", msg_size);
            error_out (rc) ;
         }
  
  /*------------------------------------------------------------------*/
  /* De_allocate the connection handle                                */
  /*------------------------------------------------------------------*/
  
         rc = ct_con_drop (connection);
  
         if (rc == CS_FAIL)
         {
            strncpy (msgstr, "CT_CON_DROP failed", msg_size);
            error_out (rc) ;
         }
  }   /* end close_connection */
  
  /********************************************************************/
  /*                                                                  */
  /* 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