KRec: Difference between revisions
Gordon.dye (talk | contribs) No edit summary |
|||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
KREC | |||
The '''KRec''' [[internal function]]: | |||
# returns the number of the last accessed key for [[indexed files]] | |||
# 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: | |||
# 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 | 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 | 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]] | ||
*[[LRec]] | *[[LRec]] | ||
*[[Rec]] | *[[Rec]] | ||
*[[RLn]] | *[[RLn]] | ||
*[[NewPage]] (for [[ | *[[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:
- returns the number of the last accessed key for indexed files
- 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:
- 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.
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: