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.

$TEXTroutineIf specified alone, it indicates the first line of code in the routine. If specified with only thelabel parameter, the line found at that specified label within the routine is returned. If specifiedwith only the offset parameter, the line at the specified offset within the routine is returned.If both label and offset are supplied, the line found at the specified offset within the specifiedlabel within the routine is returned.expression atom (@expr_atom)An indirect argument that evaluates to a $TEXT argument (label+offset^routine). For moreinformation, refer to Indirection in Using <strong>Caché</strong> <strong>ObjectScript</strong>.ExamplesThis example shows the $TEXT(label) form, which returns the line found at the specifiedlabel within the current routine. The label is also returned. If the user enters "?", the Info textis written out, along with the line label, and control returns to the initial prompt:Start READ !,"Array name or ? for Info: ",ary QUIT:ary=""IF ary="?" {WRITE !,$TEXT(Info),! GOTO Start }Info ;; This routine outputs the entire contents of a global array.QUITThis example shows the $TEXT(label+offset) form, which returns the line found at the offsetwithin the specified label, which must be within the current routine. If the offset is 0, the labelline, with the label, is returned. You can use this form in a FOR loop, to access multilinetext:Start READ !,"Array name or ? for Info: ",ary QUIT:ary=""IF ary="?" {DO InfoGOTO Start}Info FOR loop=1:1:5 { WRITE !,$TEXT(Info+loop) };; This routine outputs the entire contents of a global array.;; Specifically, it asks you to supply the name of the array;; and then writes out the current values for all existing;; nodes that contain data. It ignores any nodes;; that do not contain data.QUITThis example shows the $TEXT(+offset) form, which returns the line found at the specifiedoffset within the current routine. This form is similar to the previous form except that no labelis used. If the offset is 0, $TEXT returns the name of the current routine as filed on disk.Note that the routine name may be different from the line label in the file. Like the previousform, this form can be used in a FOR loop to access multiline text:<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 305

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

Saved successfully!

Ooh no, something went wrong!