Syntax
Each "getnext" lookup operation has five basic parts:
Ø a lookup statement
Ø a test for the end of the file
Ø field assignments and operations
Ø the getnext or getprev instruction
Ø a loop back to the end-of-file test
The syntax is like this:
Then: lookup filename . . .
subr
If: not filename
Then: [end or go elsewhere]
Then: n=filename(m); . . .
Then: getnext filename; goto subr
or:
Then: getprev filename; goto subr
Version Ref: 3.x
Description:
LOOKUP's "getnext" (get next) and "getprev" (get previous) commands make it easier to write repetitive lookups. They let you look through the lookup file repeatedly without retyping lookup statements or writing loops back to the lookup statement.
You might want to add a second test to check that the lookup key and lookup field still match - if you only want Smiths, for instance, you don't want the program to continue on to the Todds once the Smiths run out. The syntax would be something like this:
If: filename(m) ne [key field ]
Then: end or go elsewhere