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> CommandsThe following examples all return the word “<strong>Caché</strong>”:WRITE !,"Cach",*233WRITE !,*67,*97,*99,*104,*233SET accent=233WRITE !,"Cach",*accent ; variables are evaluatedWRITE !,"Cach",*232+1 ; arithmetic operations are evaluatedWRITE !,"Cach",*00233.999 ; numbers are evaluated to integersThe integer resulting from the expression evaluation may correspond to a control character.Such characters are interpreted according to the target device. For example, if the currentdevice is a terminal, the integer is interpreted as ASCII control characters. The followingcommands send ASCII codes 7 and 12 to the terminal.WRITE *7 ; Sounds the bellWRITE *12 ; Form feed (blank line)Here's an example using the form feed character:WRITE "stepping",*12,"down",*12,"the",*12,"stairs"Using Format Controls with WRITEThe f argument allows you to include any of the following format control characters. Whenused with output to the terminal, these controls determine where the output data appears onthe screen. You can specify any combination of format control characters.! Format Control CharacterAdvances one line and positions to column 0 ($Y is incremented by 1 and $X is set to 0).The actual control code sequence is device-dependent; it generally either ASCII 13 (RETURN),or ASCII 13 and ASCII 10 (LINE FEED).<strong>Caché</strong> does not perform an implicit new line sequence for WRITE with arguments. Whenwriting to a terminal it is a good general practice to begin (or end) every WRITE commandwith a ! format control character.You can specify multiple ! format controls. For example, to advance five lines, WRITE !!!!!.You can combine ! format controls with other format controls. However, note that the followingcombinations, though permitted, are not in most cases meaningful: !# or !,# (advance oneline, then advance to the top of a new screen, resetting $Y to 0) and ?5,! (indent by 5, thenadvance one line, undoing the increment). The combination ?5! is not legal.If the current device is a TCP device, ! does not output a RETURN and LINE FEED. Instead,it flushes any characters that remain in the buffer and sends them across the network to thetarget system.166 <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!