Rec

From BR Wiki
Jump to navigation Jump to search
REC(<file ref>)

The Rec(N) internal function returns the number of the record last processed in file N. For external files, the byte number of the last record processed can also be returned.

For disambiguation purposes, see also Rec Parameter for Read File Statements.

Comments and Examples

If file N is not opened, REC(N) will return -1.

To inform the operator how many records have been processed during the running of a report program, REC(N) and LREC(n) could be used in PRINT FIELDS statements to display a running record counter. The following PRINT statement illustrates the idea:

00540 PRINT "Now reading";REC(N);"of";LREC(N);"records."

Related Functions

For additional information about files, see the following functions:

Technical Considerations

  1. For external files, REC(N) can return either the record number or the byte number, depending on whether the last I/O statement used a REC= clause (the default mode) or a POS= clause (to position to a specified byte number).
  2. The use of REC within an I/O statement is strongly discouraged, especially on multi-user systems. See the Multi-user Programming for additional information.
See also REC= parameter.