# READSEQ

Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

Tags: record handling sequential file handling

# Description

The statement allows for reading from a file opened for sequential access. It takes the general form:

READSEQ Variable FROM filevar THEN | ELSE statements
1

Where:

  • Variable specifies the variable to contain next record from sequential file.
  • filevar specifies the file descriptor of the file opened for sequential access.
  • Statements Conditional jBASE BASIC statements

Each READSEQ reads a line of data from the sequentially opened file. After each READSEQ, the file pointer moves forward to the next line of data. Variable contains the line of data less the new line character from the sequential file.

The default buffer size for a READSEQ is 1024 bytes. This can be changed using the IOCTL function with the JIOCTL_COMMAND_SEQ_CHANGE_RECORDSIZE defined in the Sequential File Extensions.

An example of use would be as:

OPENSEQ ".", "report.txt" TO FILE_VAR ELSE ABORT 201, "report file"
READSEQ VAR_LINE FROM FILE_VAR THEN CRT VAR_LINE
1
2

to open a "report file" and read the first line from it.

See also PN1073 for changes to delimiter functionality as of jBASE 5.8.2.

Go back to jBASE BASIC

Go back to Programmers' Reference Guide