I know FIND NUMBER determines the no. of records matching WITH/WHERE criteria specified and doesn’t initiates any processing loop and no data fields from the database are available.
Seems FIND NUMBER…WITH combo gets *NUMBER value from Inverted List and doesn’t go through data storage and work. Let me know if this sounds ok.
However, FIND NUMBER…WITH…WHERE… combo issues S1+L1…+RC commands (as per my DBLOG) and seems go through data storage and work. An automatic internal processing loop is created to evaluate the where clause (and *COUNTER gets increased against it).
Who evaluates (ADABAS/NATURAL??) this WHERE and how?
Can you please explain why (pros of) this internal processing loop? (over a regular processing loop that a simple FIND initiates)
What could be the processing differences between:
FIND NUMBER…WITH…WHERE
and
2. FIND…WITH…WHERE
apart from:
FIND NUMBER does not result in the initiation of a processing loop and no data fields from the database are made available.
The WHERE conditions in a FIND statement (READ and HISTOGRAM, too) are applied by Natural. If the conditions test database fields, then Adabas must return those fields for Natural to process. In a FIND , this happens before you get access to the record (before Natural applies the statements within the loop). In a FIND NUMBER, there is no loop, so it’s all “under the covers.”
As far as the Adabas processing goes, there is very little difference between a FIND NUMBER and a FIND loop.
The difference is mainly one of convenience for the Natural programmer - since there is no loop initiated, there is no loop to close. There is probably a tiny difference in loop overhead within the Natural program if you use a FIND/WHERE loop to do the same thing as a FIND NUMBER/WHERE. From a readability standpoint, the FIND NUMBER is clearer if all you are doing is counting.
Obviously, you usually want to avoid doing both a FIND NUMBER and a FIND loop for the same criteria as it duplicates the work in Adabas and a bit of creative programming can usually find a way around doing the work twice.