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.

<strong>Caché</strong> <strong>ObjectScript</strong> Special VariablesBecause WRITE * does not change $X, you can send a control sequence to your terminaland $X will still reflect the true cursor position. Since some control sequences do move thecursor, you can use the SET command to set $X directly. For example, the following commandsmove the cursor to column 20 and line 10 on a Digital VT100 terminal (or equivalent)and set $X and $Y accordingly:SET dy=10,dx=20WRITE *27,*91,dy+1,*59,dx+1,*72SET $Y=dy,$X=dxANSI standard control sequences (such as escape sequences) that the device acts on but doesnot output can produce a discrepancy between the $X and $Y values and the true cursorposition. To avoid this problem use the WRITE * (integer expression) syntax and specifythe ASCII value of each character in the string. For example, instead of using:WRITE !,$CHAR(27)_"[1m"WRITE !,$Xuse this equivalent form:WRITE !,*27,*91,*49,*109WRITE !,$XAs a rule, after any escape sequence that explicitly moves the cursor, you should update $Xand $Y to reflect the actual cursor position.$X with Interprocess and Interjob CommunicationWhen you use the WRITE command to send data to either a client or server TCP device,<strong>Caché</strong> first stores the data in a buffer. It also updates $X to reflect the number of charactersin the buffer. It does not include the ASCII characters and inthis count because they are considered to be part of the record.If you flush the $X buffer with the WRITE ! command, <strong>Caché</strong> resets $X to 0 and incrementsthe $Y value by 1. If you flush the $X and $Y buffers with the WRITE # command, <strong>Caché</strong>writes the ASCII character as a separate record and resets both $X and $Yto 0.See Also• WRITE command• $Y special variable• $ZUTIL(68,22) $X Update Mode for Escape Sequences function• $ZUTIL(69,22) $X Update Mode for Escape Sequences function456 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!