Oracle® OLAP DML Reference 11g Release 2 (11.2) Part Number E17122-07 |
|
|
PDF · Mobi · ePub |
The RECNO function reports the current record number of a file opened for reading. It returns NA
when Oracle OLAP has reached the end of the file.
INTEGER
RECNO(fileunit)
A file unit number assigned to a file opened for reading in a previous call to the FILEOPEN function.
Before you can use the RECNO function, you must open the file for reading. When the file unit number is not associated with an open file or the file has been opened for writing, RECNO returns an error.
RECNO is usually used with FILEREAD or FILENEXT, which read whole records. When you are reading data from a file with the FILEGET function, which can read partial records, RECNO returns the number of times you have read data from the file, not the number of actual records.
See also the LINENUM option, which holds the current line number of output.
When the file is a text file, a record is delimited by a newline character. When the file is a binary file, you must set the file's LSIZE attribute to the record length with a FILESET statement. TEXT is the default file type.
Example 8-66 Using RECNO with FILEREAD
In the following example code, a FILEREAD statement maintains the INTEGER dimension, adding each record number associated with filename.
The text associated with each record number becomes each value of the variable textvar
.
DEFINE dim1 INTEGER DIMENSION DEFINE textvar TEXT <dim1> x = FILEOPEN('filename' R) FILEREAD x APPEND dim1 = RECNO(x) W 8 TEXTVAR