FILEIO Subroutine
Read the next line from a file into a record.
call ReadNextRecord(FILE_ID_IV, TARGET_REC)
FILE_ID_IV
A file identifier previously declared with the integer statement. This must be the same as the file identifier used when the file was opened.
TARGET_REC
The name of a record previously defined by a record definition statement. The variables specified in the record definition receive the data from the appropriate input line of the file.
Description
This subroutine allows you to read the next line of an ASCII or EBCDIC file into a previously defined record.
All input subroutines keep track of where the next line of the file begins, so you can call ReadNextRecord( ) at any time, provided there are still lines in the file to be read.
All input subroutines also use an internal buffer to read from files. ReadNextRecord( ) fills a buffer starting at the beginning of the next line, and expects to find the end of the line in the buffer. If it does not, it keeps increasing the buffer's size until it either finds the end of the line or runs out of system memory. A buffer size of 1K is best, and we recommend increments of 1K when increasing or decreasing the buffer's size.
Errors
FIO_E_BADFIELD
Bad field in a record.
FIO_E_BADLINENO
Specified line number not in file.
FIO_E_BUFFTOOSMALL
Internal buffer too small. Although an attempt was made to increase the buffer's size to fit in a complete line, system memory ran out before the current line could be accommodated. Make sure lines are terminated by a carriage return (\r) or newline (\n), otherwise the entire file will be interpreted as one line.
FIO_E_EOF
Attempt to read at end-of-file. All lines have been read.
FIO_E_FILEHANDLE
Invalid file handle - internal error.
FIO_E_FILELOCKED
File locked by another program.
FIO_E_LINETOOBIG
Current line exceeded buffer size. Although an attempt was made to increase the buffer's size to fit in a complete line, system memory ran out before the current line could be accommodated. Make sure lines are terminated by a carriage return (\r) or newline (\n), otherwise the entire file will be interpreted as one line.
FIO_E_NOTOPEN
File has not been opened. This error occurs when you try to read from a file that has not been opened.
FIO_E_OPENFORWRITE
Reading from file open for writing.
FIO_E_READACC
Read access violation. Should never happen during input.
FIO_E_SEEK
Error during seek - internal error. Check the line number specification.
FIO_E_SUBSCRIPTCOUNT
Wrong number of array subscripts. The array referenced in the record has more dimensions than the number of subscripts specified.
FIO_E_SUBSCRIPTRANGE
Array subscript reference out of range. One of the array subscripts in the record is greater than the highest allowable subscript for that dimension.
See Also
ReadRecordAtLine( ) subroutine.