Rdseq

Rdseq reads data from a text file opened by Openi or Openio.

Syntax

 Rdseq VAR_LISTRdseq VAR_LIST Using [CLASS]

Examples

 # First example: let's read words separated by commas in a text file# The lines separator is LF# They are padded by 0Local Schar WORDS(5)(1..20)Openi "MYFILE",0Using [DMP]Iomode adxium 50Using [DMP] : # asciiIomode adxirs chr$(10) Using [DMP] : # LFIomode adxifs "," Using [DMP] : # word separatorRdseq WORDS Using [DMP]Openi Using [DMP]# Second example: let's read a blob in a fileRdseq MYBLOB # Third example: read a multi-dimensional arrays of IntegersLocal Integer ARRAY(1..5,1..10,1..5,1..4)Openi "dumpfile",0# If the whole array needs to be read:# Rdeq NUMBER,ARRAY will fail (only one unspecified dimension can be given)# Let's perform loopsFor I=1 to dim(ARRAY,1)For J=1 to dim(ARRAY,2)For K=1 to dim(ARRAY,3)Rdseq ARRAY(I,J,K,1..dim(ARRAY,4))Next KNext JNext I

Description

Rdseq allows reading ASCII files.

Rdseq reads from a file and fills the elements on the list until the end of line defined by adxirs is reached. Every element is separated from the next element by adxifs. If the end of line is reached before all the elements are set, the remaining elements are set to null values.

The elements are transformed from text format (according to adxium value) to the variables listed.

Comments

If the file is opened with a class name, the function adxseek(0) (or adxseek("CLASS")) gives the position (in bytes, from the beginning of the file) where the next read operation is done. The return value is incremented each time a Rdseq is performed. Its value is -1 if no file is opened for reading.

The system variable fstat is set to 1 if the read operation reached the end of the file.

The variables that could not be assigned because the end of file was reached or because the number of elements given is reached are set to null values.

Associated errors

Error codeDescription
10INTEGER_EXPR is not an integer expression.
55Too many unspecified dimensions given on variables written.

See also

Putseq, Getseq, Wrseq, adxseek, Seek, Openi, Openo, Openio.