Date:         Thu, 20 Apr 1995 10:33:44 EDT
Reply-To:     The NOMAD2 Discussion List
Sender:       The NOMAD2 Discussion List
From:         "Nicholas A.Rawlings"
Subject:      how to find record no.?

>    Is there anyone ever know a function like recno()?
> For total record number, I use:
>LIST COUNT(KEYITEM1) NOPRINT SET &TOTAL_REC

At risk of imbroglio, I'll comment a bit. The SIU School of medicine
uses mainframe NOMAD and native NOMAD databases, so I'll jump to the
belief that Ku.en-Yih's questions relate to that. Were the records in
DB2 or Oracle or whatever, then the answers would be different.
The simplest and most efficient way to find out how many records are
in a table or master or segment is to use DDQUERY('used',name). For
example, if I had a NOMAD master named RALPH, then
   &total_rec=ddquery('used','ralph');
would be swift - much swifter than your LIST. I wouldn't have to read
a single RALPH-record to know the answer. On the other hand, if there
are RPROCs or SELECTs in effect, that answer is wrong, 'cause it
includes every record, even those which you wouldn't see. To know how
many would pass your filter, use LIST, but use NUM instead of CNT,
it's faster.
As to the "record number of an instance" issue, the answer is
tougher. There are some record numbers which NOMAD keeps for both
standard and Btree files, with different uses and meanings to each,
but none is what you appear to want, namely the relative position of
this instance in a file: is this the 17th or the 202nd? Nomad just
doesn't know (or care). The meaning is too subjective.
On the other hand, if you are using INSTANCE function arrays in a
simulation of the DBEDIT facility, then you could perform your own
maintenance of indices within your procedure to cope with inserts,
deletes, and key changes. Many have done just that.
back to index