Purpose

GETLPSEQ retrieves the last sequence number used. It works only for auto-sequenced files, not for indexed paging.
 

Syntax

#variable = GETLPSEQ(file-name)
 

Operation

#variable is a numeric variable to which the sequence number is assigned. If the result is zero, there are no paging records with the specified key.
file-name
 is the name of the paging file that is to be queried. It should be a string enclosed in quotes, or an alpha variable containing the file name.
 

Remarks

The file must be referenced in the function, and the file must have been defined with a key. All parts of the key, except the sequence number part, must be specified by some means, such as the assignment of a string to the key variable.

The GETLPSEQ command can be used on any file within the function. Any logic point, the best place being the default logic, can use it.

There are two good reasons to restrict usage: It should not be used against a file that has an outstanding locked record, as GETLPSEQ would release the lock. This is why execution from the default logic will always be safe. It need only be issued once.  Assuming that you have sole access to the file, multiple GETLPSEQ calls to that file (without intervening writes) will return the same number. Therefore multiple GETLPSEQ calls in this scenario inflict a reasonably large performance penalty.  However, if multiple users have write access to the file, multiple calls may be necessary.
 

Comment on this topic

Topic ID: 520061

 
 
 

Table of Contents

Index

Glossary

-Search-

Back