!REGION: procedures for accessing parts (regions) of files

externalroutinespec  access file(string (255)filename,integer  mode,
                             integername  ref,size)
externalroutinespec  deaccess file(integer  ref)
externalroutinespec  read region(integer  ref,byte,bytes,bytename  buffer)
externalroutinespec  write region(integer  ref,byte,bytes,bytename  buffer)
endoffile 

! ACCESS FILE
! Opens the file and returns in SIZE the number of bytes in the file,
! and in REF a token (actually the filestore transaction number) which
! must be passed to DEACCESS FILE, READ REGION, and WRITE REGION.
! MODE=0: Read-only, MODE=1: Read-modify.

! DEACCESS FILE
! Just closes the file

! READ/WRITE REGION
! Reads/writes BYTES bytes from/to the file specified by REF to/from
! store at BUFFER, starting with byte BYTE of the file
! (BYTE=0 means beginning of file).