From the documentation:
If one or more statements are specified with the IF NO RECORDS FOUND clause, the statements will be executed immediately before the processing loop is entered. If no statements are to be executed before entering the loop, the keyword ENTER must be used.
Here is the structured syntax
IF NO [RECORDS] [FOUND]
{ ENTER }
{statement }
END-NOREC
In other words, ENTER is mutually disjoint from and statements. You cannot have ENTER and any statements in the NO RECORDS clause.
If you comment out #GP-VIEW-FOUND:=‘N’ , your program will compile.
Now, for the reason for this option.
If you do not have an IF NO RECORDS found clause, and there are no records, you will simply skip the loop.
Suppose I want to do the loop if there are NO RECORDS found. Further, assume you do not want to do anything special before doing the loop. If you try:
FIND
IF NO RECORDS FOUND
END-NOREC
::::
You will get a compiler error :
NAT0226 An empty statement block is not allowed.
So, the word ENTER, which is basically equivalent to the word IGNORE for a plain IF.
Ralph, Matthias, and others who didn’t believe there was an ENTER option. Neither did I. I was actually going to the documentation to see if I could use IGNORE (you can) when I “discovered” ENTER.
Why there are two words with identical functionality is a bit of a mystery, especially since IGNORE is used in so many places to permit a null construct.
Would be interesting to know when ENTER “entered” (couldn’t resist) the language. Perhaps in Report Mode, where the syntax was always a bit strange for NO RECORDS.
steve