The EPI COM classes support synchronous ("blocking") and deferred synchronous ("polling") protocols. The Visual Basic environment does not support the asynchronous calls that are available in the C++ classes.
In the previous example a Session object was used with the default synchronization type of cclSync. When this Session object was used as the first parameter on Terminal.Start or Terminal.Send, a synchronous link call was made to CICS®. The Visual Basic program was then blocked until the reply was received from CICS. When the call returned updated screen data from CICS was immediately available in the Screen object.
Sub EPIDSync_Click()
'Create a session object (deferred synchronous)
Set Session = New CclOSession
Session.SetSyncType cclDSync
Terminal.Start Session, "CESN", ""
End Sub
Sub EPIReply_Click() If terminal.State <> cclDiscon And terminal.State <> cclError Then If terminal.PollForReply Then 'Screen has been updated, output some fields Set Screen = Terminal.Screen Set Field = Screen.FieldByIndex(1) List1.AddItem Field.Text Else List1.AddItem "No Reply from CICS yet" End If End If End Sub
A CICS server transaction may send more than one reply in response to a Terminal.Start or Terminal.Send call. More than one Terminal.PollForReply call may therefore be needed to collect all the replies. Use the Terminal.State method to find out if further replies are expected. If there are, the value returned will be cclServer.