# FIND NUMBER Understanding

**URL:** <https://techcommunity.softwareag.com/t/find-number-understanding/94101>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [July 12, 2010, 1:16pm UTC](https://techcommunity.softwareag.com/t/find-number-understanding/94101 "2010-07-12T13:16:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ats](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@Ats](https://techcommunity.softwareag.com/u/Ats)\
**Post date:** [July 12, 2010, 1:16pm UTC](https://techcommunity.softwareag.com/t/find-number-understanding/94101/1 "2010-07-12T13:16:32Z")

</div>

Hi Friends,

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:

1. 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.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [July 12, 2010, 2:39pm UTC](https://techcommunity.softwareag.com/t/find-number-understanding/94101/2 "2010-07-12T14:39:49Z")

</div>

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.”

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [August 8, 2010, 11:40pm UTC](https://techcommunity.softwareag.com/t/find-number-understanding/94101/3 "2010-08-08T23:40:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:58pm UTC](https://techcommunity.softwareag.com/t/find-number-understanding/94101/4 "2021-04-02T14:58:45Z")

</div>


