Skip to main content

$ZA (ObjectScript)

Contains the status of the last READ on the current device.




$ZA contains the status of the last READ on the current device.

This special variable cannot be modified using the SET command. Attempting to do so results in a <SYNTAX> error.

$ZA with Terminal I/O

$ZA is implemented as a sequence of bit flags, with each bit indicating a specific piece of information. The following table shows the possible values, their meanings, and how to test them using the modulo (#) and integer divide (\) operators:

Bit Test Meaning
0 $ZA#2 A <CTRL-C> arrived, whether or not breaks were enabled.
1 $ZA\2#2 The READ timed out.
2 $ZA\4#2 I/O error.
8 $ZA\256#2 InterSystems IRIS detected an invalid escape sequence.
9 $ZA\512#2 The hardware detected a parity or framing error.
11 $ZA\2048#2 The process is disconnected from its principal device.
12 $ZA\4096#2 For COM ports: CTS (Clear To Send). A signal sent from the modem to its computer indicating that transmission can proceed. For TCP devices: the device is functioning in Server mode.
13 $ZA\8192#2 For COM ports: DSR (Data Set Ready). A signal sent from the modem to its computer indicating that it is ready to operate. For TCP devices: the device is currently in the Connected state talking to a remote host.
14 $ZA\16384#2 Ring set if TRUE.
15 $ZA\32768#2 Carrier detect set if TRUE.
16 $ZA\65536#2 CE_BREAK COM port error state.
17 $ZA\131072#2 CE_FRAME COM port error state.
18 $ZA\262144#2 CE_IOE COM port error state.
19 $ZA\524288#2 CE_OVERRUN COM port error state.
20 $ZA\1048576#2 CE_RXPARITY COM port error state.
21 $ZA\2097152#2 CE_TXFULL COM port error state.
22 $ZA\4194304#2 TXHOLD COM port error state. Set if any of the following fields are true in the error mask returned by ClearCommError(): fCtsHold, fDsrHold, fRlsdHold, fXoffHold, fXoffSent.
24 & 25 $ZA\16777216#4 InterSystems IRIS requested DTR (Data Terminal Ready) setting: 0=DTR off. 1=DTR=on. 2=DTR handshaking. When set (1), indicates readiness to transmit and receive data.

While many of the conditions that $ZA shows are errors, they do not interrupt the program’s flow by trapping to $ZTRAP. (A <CTRL-C> with breaks enabled traps to $ZTRAP.) A program concerned with these errors must check $ZA after every READ.

COM ports use bits 12 through 15, 24 and 25 to report the status of modem control pins. This can be done regardless of whether InterSystems IRIS modem control checking is on or off for the port. A user can enable or disable $ZA error reporting for COM ports by setting the OPEN or USE command portstate parameter (byte 8, to be specific). If error reporting is enabled, the port error state is reported in bits 16 through 22. For further details, see Terminal I/O.

You can use the DisconnectErr()Opens in a new tab method of the %SYSTEM.ProcessOpens in a new tab class for modem disconnect detection for the current process. The system-wide default behavior can be established by setting the DisconnectErrOpens in a new tab property of the Config.MiscellaneousOpens in a new tab class.

See Also

FeedbackOpens in a new tab