InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference

ObjectScript Reference
Previous section           Next section
InterSystems: The power behind what matters   

Contains the truth value resulting from the last command using the timeout option.
$TEST contains the truth value (1 or 0) resulting from the last command with a timeout. $TEST is set by the following commands, regardless of whether they are entered at the Terminal prompt or encountered in routine code:
Issuing these commands without a timeout does not set $TEST.
Setting $TEST
You can use the SET command to set $TEST to a boolean value. A value of 1, or any non-zero numeric value, sets $TEST=1. A value of 0, or a non-numeric string value, sets $TEST=0.
$TEST can be set by any command or function that can return a logical condition.
Maintaining $TEST
A successful JOB, LOCK, OPEN, or READ command that did not specify a timeout does not change the existing value of $TEST.
The DO command maintains the value of $TEST when calling a procedure, but not when calling a subroutine. For details, refer to the DO command.
The ZBREAK command maintains the value of $TEST when calling execute_code. For details, refer to the ZBREAK command.
The following code performs a timed read and uses $TEST to test for completion of the read.
   READ !,"Type a letter: ",a#1:10
   IF $TEST { DO Success(a) }
   ELSE { DO TimedOut }
   WRITE !,"Received data: ",val
   WRITE !,"Timed out"
Operations That Do Not Set $TEST
JOB, LOCK, OPEN, and READ commands without a timeout have no effect on $TEST. Postconditional expressions also have no effect on $TEST.
The block-oriented IF command does not use $TEST in any way.
Unsuccessful Timed Operations
InterSystems IRIS does not produce an error message after an unsuccessful timed operation. Your application must check $TEST and then produce an appropriate message.
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-16 05:50:13