Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 74
Using the SIO Procedures: An Example
!This is a TAL example
?INSPECT, SYMBOLS, NOMAP
?NOLIST, SOURCE $SYSTEM.SYSTEM.GPLDEFS
?LIST
!Allocate the RUCB and the common FCB:
ALLOCATE^CBS(RUCB,COMMON^FCB,2);
!Allocate an FCB for each SIO file:
ALLOCATE^FCB(INFILE," #IN ");
ALLOCATE^FCB(OUTFILE," #OUT ");
LITERAL BUFSIZE = 128; !size of I/O buffer
LITERAL OUTBLKLEN = 4096; !size of output block
INT .OUTBLKBUF[0:OUTBLKLEN/2 -1]; !output block buffer
INT .BUFFER[0:BUFSIZE]; !read/write buffer
! (BUFSIZE + 1)
INT FILE^TYPE; !type of disk file
STRING .SBUFFER := @BUFFER[0] '<<' 1; !string pointer to
! read/write buffer
STRING .S^PTR; !pointer to end of
! string
?NOLIST,SOURCE $SYSTEM.SYSTEM.EXTDECS0(SET^FILE,INITIALIZER,
? CHECK^FILE,DEVICEINFO,FNAMECOMPARE,
? READ^FILE,WRITE^FILE,CLOSE^FILE,
? OPEN^FILE,PROCESS_STOP_)
?LIST