KRec: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
m (1 revision)
 
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
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]].
KREC


When processing a linked list file, KRec is updated with the location of an anchor record only under the following conditions:
The '''KRec''' [[internal function]]:


:1.) A [[Rec]]=(anchor record) is processed.
# returns the number of the last accessed key for [[indexed files]]
:2.) An anchor record is read.
# returns the number of records accessed since the last [[NEWPAGE]] for [[display files]]
:3.) An anchor record is written or deleted.
Note- following NEWPAGE with a semicolon (e.g. NEWPAGE; ) suppresses the zeroing of KREC.
 
When processing a linked file, KRec is updated with the location of an anchor record only under the following conditions:
 
# A [[Rec]]=(anchor record) is processed.
# An anchor record is read.
# 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.
[[Restore]] REC=(non-anchor)sets KRec to zero. KRec remains otherwise unaffected during [[Read]] and [[Write]] statement processing.


====Comments and Examples====
====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.
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.
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 [[Rec]]N) function.
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 [[Rec]](N) function.


====Related Functions====
====Related Functions====
For additional information about files, see the following functions:  
For additional information about files, see the following functions:  
*[[Exists]]
*[[Exists]]
*[[File$]]
*[[File$]]
Line 24: Line 33:
*[[KLn]]
*[[KLn]]
*[[KPs]]
*[[KPs]]
*[[KRec]
*[[LRec]]
*[[LRec]]
*[[Rec]]
*[[Rec]]
*[[RLn]]
*[[RLn]]
*[[NewPage]] (for [[display files]])
*[[NewPage]] (for [[Display Files]])


<noinclude>
<noinclude>
[[Category:Internal Functions]]
[[Category:Internal Functions]]
</noinclude>
</noinclude>

Latest revision as of 20:31, 16 October 2022

KREC

The KRec internal function:

  1. returns the number of the last accessed key for indexed files
  2. returns the number of records accessed since the last NEWPAGE for display files

Note- following NEWPAGE with a semicolon (e.g. NEWPAGE; ) suppresses the zeroing of KREC.

When processing a linked 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 Rec(N) function.

Related Functions

For additional information about files, see the following functions: