cwbCO_Disconnect

Purpose

Disconnect from the specified iSeries™ host service.

Syntax

 
UINT CWB_ENTRY cwbCO_Disconnect(
                             cwbCO_SysHandle     system,
                             cwbCO_Service       service,
                             cwbSV_ErrHandle     errorHandle );

Parameters

cwbCO_SysHandle system - input
Handle that was returned by a previous call to either cwbCO_CreateSystem or cwbCO_CreateSystemLike. It identifies the iSeries system from which to disconnect.
cwbCO_Service service - input
The service from which to disconnect on the iSeries system. Valid values are those listed at the start of this file, except for the value CWBCO_SERVICE_ANY. If CWBCO_SERVICE_ALL is specified, the connections to ALL connected services will be ended, and all connection usage counts reset back to zero.
cwbSV_ErrHandle errorHandle - input/output
Any returned messages will be written to this object. It is created with the cwbSV_CreateErrHandle API. The messages may be retrieved through the cwbSV_GetErrText API. If the parameter is set to zero, or if the errorHandle is invalid, no messages will be retrieved.

Return Codes

The following list shows common return values.

CWB_OK
Successful completion.
CWB_INVALID_API_HANDLE
Invalid system handle.
CWB_SERVICE_NAME_ERROR
The service identifier is invalid.
CWB_NOT_CONNECTED
The single service was not connected.

Usage

This function should be called when a connection that is established by using cwbCO_Connect no longer is needed.

If any service specified cannot be disconnected, the return code will indicate this error. If more than one error occurs, only the first one will be returned as the API return code.

Usage Notes® for individual service disconnect:
This function will cause the usage count for this system object's specified service to be decremented, and may or may not end the actual connection. For more information, read the Usage Notes for the cwbCO_Connect API.

Disconnecting a service that is not currently connected results in CWB_NOT_CONNECTED.

An individual service is gracefully disconnected.

Usage Notes for CWBCO_SERVICE_ALL:
The return code CWB_NOT_CONNECTED is not returned when CWBCO_SERVICE_ALL is specified, regardless of the number of connected services.

Requesting that all active services be disconnected may generate messages on the iSeries.