EM3270 Manual
Tandem EM3270 Manual—110332 G-1
G
Data-Stream Switching
Switching the application environment during a dual-application session can be
requested either by pressing the SWITCH key or by detecting a character string in the
data stream. To implement data-stream switching, declare a procedure that inspects the
data stream looking for the character string and replace the existing procedure with your
inspection procedure.
Figure G-1 shows the declaration for a data-stream inspection procedure. This procedure
switches from IBM to Tandem when it detects DO SWITCH in the data stream. It
switches from Tandem to IBM when it detects SWITCH BACK. You can change the
characters of the strings that initiate the switches according to the requirements of your
application.
Installing this procedure does not disable the use of the SWITCH key to initiate a
switch.
Figure G-1. Procedure Declaration for Data-Stream Inspection
INT PROC inspect^data^stream ! (source, buffer, length, display)
INT source; ! Upon entry defines originator of data:
! 0 = IBM 1 = Tandem application
STRING .EXT buffer; ! Upon entry points to the data buffer
INT length; ! Upon entry contains the number of
! characters in the buffer
INT display; ! Upon entry is currently displayed
! screen: 0 = IBM 1 = Tandem application
! The procedure returns:
! -1 if an environment switch is indicated
! 0 if not
BEGIN
LITERAL ibm = 0,
tandem = 1,
do^switch = -1,
dont^switch = 0;
IF source = ibm THEN !Handle data from IBM
BEGIN
IF buffer = "DO SWITCH" AND display = ibm THEN
RETURN do^switch
ELSE
RETURN dont^switch;
END
ELSE !Handle data from Tandem application
BEGIN
IF buffer = "SWITCH BACK" AND display = tandem THEN
RETURN do^switch
ELSE
RETURN dont^switch;
END;
END;