The automatic interface subroutines are used to conduct an APPC conversation in which ESL APPC automatically switches the conversation state when appropriate to do so. All ESL APPC subroutines can be used in both the automatic interface and the controlled interface, with the exception of APPCReceiveNotify. This subroutine is used only in the controlled interface. For information about the controlled interface and the alternative level of support that it offers, see The Controlled Interface.
Your ESL APPC program indicates, when it starts a conversation, the style of interface it will use. Automatic state switching is enabled by calling the APPCStart and APPCAcceptStart subroutines with the STATE_SWITCH argument set to APPC_Automatic. Automatic state switching can be disabled in either of two ways:
1.By calling the APPCStart and APPCAcceptStart subroutines with the STATE_SWITCH argument set to APPC_Controlled.
2.By setting the INACTIVITY_TIMEOUT argument in the ESL APPC profile to zero (regardless of the setting of STATE_SWITCH).
Your program can voluntarily switch from send state to receive state by either of the following:
•Using APPC_ReadyToReceive as the value for the MORE_TO_SEND argument on the APPCSendString or APPCSendDLLData subroutine calls.
•Calling the APPCReadyToReceive subroutine.
If you are using confirmation processing in the automatic interface, you should issue the request for confirmation from the partner as a parameter on the APPCSend... subroutines, or issue a separate call to APPCRequestConfirm immediately after doing the send. Otherwise, the conversation state may switch from send to receive and, once in receive state, your attempt to send a request for confirmation would be rejected as an error.
You should also monitor for APPC_RequestToSend event notifications to know that the conversation state has switched.
Note: If the partner issues a request to send, the conversation state for your program changes from send to receive if there is nothing pending to send and the inactivity timer has timed out. Automatic state switching will not occur if the timer value is set to zero. See APPCSetInitProfile Subroutine and APPCSetAcceptProfile Subroutine.
ESL APPC Subroutines to Send/Receive String Data
The following are the subroutines for sending and receiving string data:
call APPCStart ( CONVERSATION_ID,
PROFILE_NAME,
SYNC_LEVEL,
STATE_SWITCH )
call APPCAcceptStart ( CONVERSATION_ID,
PROFILE_NAME,
STATE_SWITCH )
call APPCSendString ( CONVERSATION_ID,
STRING_VAR,
AUTO_CONVERT,
SEND_IND,
MORE_TO_SEND )
call APPCReadyToReceive ( CONVERSATION_ID )
call APPCGetString ( CONVERSATION_ID,
STRING_VAR,
AUTO_CONVERT )
call APPCGetSystemError ( CONVERSATION_ID,
WORK_REQUEST_ERROR,
WORK_REQUEST_IDENTIFIER,
APPC_VERB,
PRIMARY_ERROR_CODE,
SECONDARY_ERROR_CODE )
call APPCFlush ( CONVERSATION_ID )
call APPCEnd ( CONVERSATION_ID,
SYNC_LEVEL )