11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• When reading from a terminal, sequential file, or other character-based I/O device, $ZBcontains the terminating character of the read operation. This can be a terminator character(such as ), the final character of the input data if the read operation does notrequire a terminator character, or the null string if a terminator character is required butwas not received (for example, if the read operation timed out).• When reading from a block-based I/O device, such as magnetic tape, $ZB contains thenumber of bytes remaining in the I/O buffer. $ZB also contains the number of bytes inthe I/O buffer when writing to magnetic tape.This special variable cannot be modified using the SET command. Attempting to do so resultsin a error.$ZB and $KEY can both be used to return the READ termination character when readingfrom a character-based device or file. For character-based reads, these two special variablesare very similar, but not identical. For block-based reads and writes (such as magnetic tape)use $ZB; $KEY does not provide support for block-based read and write operations. See$KEY for further details.NotesReading from a Terminal or File$ZB contains the terminating character (or character sequence) from a read operationinvolving a terminal, sequential file, or other character-based I/O device. $ZB can containany of the following:• A termination character, such as a carriage return.• An escape sequence (up to 16 characters).• The nth character in a fixed-length READ x#n. (In this case, the $KEY special variablereturns the null string.)• The single character of READ *x.• A null string ("") after a timed READ expires.For example, consider the following variable-length read with a five-second timeout:ZbreadREAD !,"Enter number:",num:5WRITE !, numWRITE !, $ASCII($ZB)QUIT$ZB<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 463

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!