Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 56
Checking for a Break Message
To take BREAK ownership, you must supply the FCB name for the terminal from which
your program will accept Break messages:
CALL TAKE^BREAK(TERM^FCB);
The effect of using TAKE^BREAK with an SIO file is like issuing a call to SETMODE
function 11 on a regular Guardian file, with parameter 2 of the SETMODE call equal
to 0.
When your process reads a Break message from its $RECEIVE file, the default action
is to return a carriage return/line feed combination of characters to the terminal. You
can turn off this feature either by calling the SET^CRLF^BREAK operation of the
SET^FILE procedure with the new-value parameter equal to zero or by turning off the
CRLF^BREAK flag when calling the OPEN^FILE procedure:
CALL SET^FILE(TERM^FCB,
SET^CRLF^BREAK,
0);
You resume this feature by turning the SET^CRLF^BREAK flag on again:
CALL SET^FILE(TERM^FCB,
SET^CRLF^BREAK,
1);
Checking for a Break Message
Use the CHECK^BREAK procedure to check for a pressed BREAK key.
Once you have taken ownership of the BREAK key, your process will receive a Break
message in its $RECEIVE file whenever the BREAK key is pressed on the terminal
indicated in the call to the TAKE^BREAK procedure. Using CHECK^BREAK to read
this message avoids having to read directly from $RECEIVE and having to check the
condition code. You simply supply CHECK^BREAK with the FCB name for the
terminal where you expect the BREAK key to be pressed:
CALL CHECK^BREAK(TERM^FCB);
If $RECEIVE is not open when you call CHECK^BREAK, SIO opens it for you and
checks for the Break message; $RECEIVE stays open until you subsequently call
GIVE^BREAK. If the file is already open by SIO, CHECK^BREAK checks for the
Break message and leaves the $RECEIVE file open. The $RECEIVE file must not be
open as a non-SIO file, or CHECK^BREAK returns an error indication.
Returning BREAK Ownership
Once you no longer need ownership of the BREAK key, you can return its ownership to
the previous owner by issuing the GIVE^BREAK procedure. You simply supply the
Note. For CHECK^BREAK to work, SIO should handle the Break message. You should
therefore not return the Break message to your program using the SET^FILE
SETSYSTEMMESSAGES[MANY] operation.