KRec

From BR Wiki
Revision as of 10:14, 17 January 2012 by Mikhail.zheleznov (talk | contribs) (moved KRec to KREC)
Jump to navigation Jump to search

The KRec internal function returns the number of records accessed since the last NEWPAGE for display files; returns the number of the last accessed key for indexed files.

When processing a linked list file, KRec is updated with the location of an anchor record only under the following conditions:

1.) A Rec=(anchor record) is processed.
2.) An anchor record is read.
3.) An anchor record is written or deleted.

Restore REC=(non-anchor)sets KRec to zero. KRec remains otherwise unaffected during Read and Write statement processing.

Comments and Examples

KRec(N) is really two functions under one name. It has one use with display files, and another use with indexed internal files.

When file N is a display file, KRec(N) acts as a line counter for lines output to the file. This feature is especially useful with printers in counting how many lines have already been printed on a page. Also, outputting a NEWPAGE (to advance the paper to the top of the next page) resets this counter to zero. Print KRec(255) will return the number of lines output to the standard printer file (#255) since the last PRINT #255:NEWPAGE was issued.

If file N is an internal file opened for Keyed processing, then KRec(N) returns the number of the last record accessed in the key file; this is different from the last record accessed in the master file, which can be found by the RecN) function.

Related Functions

For additional information about files, see the following functions: