Rec: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (moved Rec to REC)
No edit summary
Line 1: Line 1:
'''Rec(N)''' 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.
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.


====Comments and Examples====
====Comments and Examples====

Revision as of 21:01, 30 July 2013

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.

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.