Find records which are NOT in a descriptor ...

Hello all!

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

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


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.

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…

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,

Thanks! Your solution is working great!

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

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

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