11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

$VIEWStart OPEN 63WRITE !,"Opening view buffer."READ !!,"Number of block to read in: ",block QUIT:block=""VIEW blockFOR i=1:1 {SET x=$VIEW(i,-5)IF x="" {WRITE !!,"End of block: ",blockCLOSE 63QUIT }WRITE !,"Offset = ",iWRITE !,"Value = ",x}GOTO Start+2CLOSE 63QUITFor a global block, typical output produced by this routine might appear as follows:Opening view buffer.Number of block to read in:3720Offset = 1Value = ^client(5)Offset = 2Value = John JonesOffset = 3Value = ^client(5,1)Offset = 4Value = 23 Bay Rd./Boston/MA 02049...Offset = 126Value = ^client(18,1,1)Offset = 127Value = Checking/45673/1248.00End of block: 3720Number of block to read in:Reverse Order Byte ValuesYou can return byte values in reverse order by using the codes provided with the lengthparameter. When you specify the letter O, enclosed in double quotes, in length, $VIEWreturns a byte value in reverse order.Consider the following example:USE IOFOR Z=0:0 {WRITE *-6SET NEXTBN=$VIEW(LINKA,0,"3O")QUIT:NEXTBN=0 }In the previous example, the length parameter of $VIEW is “3O” (3 and the letter O). Thisindicates a length of the next three (3) bytes in reverse order (O). Thus, $VIEW starts at aposition in memory (the view buffer—as indicated by a mode of 0) and returns the highestbyte, the second highest byte, and the third highest byte.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 313

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

Saved successfully!

Ooh no, something went wrong!