I have also modified it to use sysopen and sysseek, for some reason using sysread with the offset parameter doesn't work for me hence the sysseek.
sysread FILEHANDLE,SCALAR,LENGTH,OFFSET
sysread FILEHANDLE,SCALAR,LENGTH
...
An OFFSET may be specified to place the read data at some plac
+e in
the string other than the beginning. A negative OFFSET specifi
+es
placement at that many characters counting backwards from the
+end
of the string. A positive OFFSET greater than the length of SC
+ALAR
results in the string being padded to the required size with "
+\0"
bytes before the result of the read is appended.
In other words, OFFSET determines where inside $BufferByte the data is placed, not where where the data is read from the file.