# Find records which are NOT in a descriptor ...

**URL:** <https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-Basics-on-Linux-Unix-Windows, Adabas-on-Windows-UNIX, Adabas-on-Linux\
**Created:** [February 14, 2006, 12:42pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880 "2006-02-14T12:42:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [February 14, 2006, 12:42pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/1 "2006-02-14T12:42:56Z")

</div>

Hello all!

Here’s an excerpt of a file’s ADAFIN-statistics:

```auto
Descriptor AA , Format: A , Options: None
[...]
Values: different: 38,122 total: 38,354
[...]

Descriptor AB , Format: U , Options: NU
[...]
Values: different: 15 total: 38,349
```

It is my understanding…  
… that this file got exactly 38354 records  
… that 5 records got a zero value in field AB and therefore they don’t appear in descriptor AB.

My question: How can I read this 5 records without reading the whole file? At the moment; I think, it’s not possible, but maybe there is some unknown ADABAS/NATURAL-trick…

Kind regards

Matthias

---

<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:** [February 14, 2006, 1:28pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/2 "2006-02-14T13:28:39Z")

</div>

You are right, it’s not possible.

The only “trick” here would be to reload the file with AB not being NU, then you can explicitely read those 5 records.

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [February 14, 2006, 9:22pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/3 "2006-02-14T21:22:08Z")

</div>

I thought, maybe it’s possible to create two retain-sets and link them with XOR or something like that.  
I dealt too much with SQL the past few weeks…

---

<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:** [February 23, 2006, 11:00pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/4 "2006-02-23T23:00:42Z")

</div>

Perform S1 command with H option to search all records with AA not equal blank.  
Perform S1 command with H option to search all records with AB not equal 0.  
Perform S8 command connecting the results of the two S1 commands with the NOT operator.

This way you must read the complete index, but not the data records.

Kind regards,  
Wolfgang

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [February 24, 2006, 2:30pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/5 "2006-02-24T14:30:05Z")

</div>

Thanks! Your solution is working great!

> [@Wolfgang Obmann](#):
>
> Perform S1 command with H option to search all records with AA not equal blank.

To get all records of AA, I search all records with AA not equal blank OR equal blank…  
In Natural your solution would be:

```auto
define data local
1 file28 view of file28
  2 aa (A15) /* Options: DE
  2 ab (N03) /* Options: DE,NU
end-define
*
find-aa.
find number file28 with aa eq " " or aa ne " " retain as 'all-aa'
display *NUMBER(find-aa.)
*
find-ab.
find number file28 with ab > 0 retain as 'all-ab'
display *NUMBER(find-ab.)
*
find-not.
find file28 with 'all-aa' and not 'all-ab'
  display file28
end-find
display *NUMBER(find-not.)
*
release set 'all-aa'
release set 'all-ab'
*
end
```

I was very close to this solution. But I only tried the operator XOR…

---

<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:38pm UTC](https://techcommunity.softwareag.com/t/find-records-which-are-not-in-a-descriptor/57880/6 "2021-04-02T14:38:55Z")

</div>


