I have a program which needs to work with images, and in order to do so it reads the image metadata from a text file; the metadata is fixed-length and consistently encoded in the following manner:
- 001-099: Folder
- 100-198: Filename
- 199-206: Width
- 207-214: Height
- 215-215: Newline
The metadata is stored in the user folder with the same filename as the data file. I am able to access this data easily enough with the following field edit:
note ** The SEEKTEST stdjob has a Record Size of 215 bytes.
define|port $var01/SEEKTEST//$01.
move <filename> to $var01.
open $01|rd.
seek $01 0 0 else
pause "Unable to access metadata file";
stop.
get $01 else
pause "End of file; terminating";
stop.
pause $01@01@.
close $01.
stop.
This works as expected; it shows all 215 bytes of the retrieved record so the data is obviously being read according to the SEEKTEST record size.
However, whenever I try to access any bytes past 128, it gives me an invalid substring error. For example:
note ** This shows the folder, as expected.
pause $01@01:001-099@.
note ** This doesn't show the filename, just throws an invalid substring error.
pause $01@01:100-198@.
Is there any way to work with the rest of the data in this field? Mostly, I'm just looking for a way to copy the subfields into declared variables that can be handled like normal.