# PF7/PF8 QUERY

**URL:** <https://techcommunity.softwareag.com/t/pf7-pf8-query/80382>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [March 4, 2009, 8:55am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382 "2009-03-04T08:55:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 4, 2009, 8:55am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/1 "2009-03-04T08:55:05Z")

</div>

Hello Everybody,

I am new to Natural/Adabas and trying to gain expertise on the same.

We have this requirement, where in we need to display 5 records per page. And on hitting PF8 the next set of 5 records should be displayed until “No More Records Are Available for display” matching some criteria and similarly on hitting PF7 we should be able to navigate through previously displayed records (again 5 per page).

May I request for some guidelines/algorithm/sample code to implement the PF7/PF8 logic in natural?

Thanks for all your help!

Regards  
Simmi

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 4, 2009, 9:07am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/2 "2009-03-04T09:07:10Z")

</div>

For PF8  
I used an approach wherein I store the 5th record ISN for a given record and start from next ISN and find & display upto five records on hitting a PF8 key.

But unable to implement a similar logic for PF7 as I am unaware how to read a file/table in descending sequence of ISN.

Moreover the arrays I have used are declared as 1:5 (max five occurences).

I am not sure whether this approach is correct or not, just working on possibilities,hence any assistance would help me achieve my objective.

Awaiting some quick replies.

Thanks!

---

<div class="post-metadata">

**Author:** ![Finn\_the\_Dane1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/finn_the_dane1/32/132_2.png) [@Finn\_the\_Dane1](https://techcommunity.softwareag.com/u/Finn_the_Dane1)\
**Post date:** [March 4, 2009, 1:22pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/3 "2009-03-04T13:22:15Z")

</div>

Perhaps you should also have a look at the  
dynamic sequence feature  
“READ EMPLOYEES-VIEW IN DYNAMIC #DIR SEQUENCE BY NAME”  
See documentation for read or  
look at the V4-RDDYN example in the SYSEXV libary.

Finn

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 4, 2009, 3:05pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/4 "2009-03-04T15:05:20Z")

</div>

Hi Finn,

Thanks for the quick reply. Is the approach undertaken by me a right approach?

1. Do we usually display records in ISN sequence? I am still working on the solution provided by you. Getting an error.Will get back on the same  
if it doesn’t work.

2. Is there any other alternative to this PF7/PF8? - like using arrays /dynamic instead of ISN?

May I request for sample code/algorithm for the same?

Thanks!

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 4, 2009, 3:30pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/5 "2009-03-04T15:30:04Z")

</div>

Hello,

Sincere apologies. Forgot to mention the following:-

Objective -  
I need to display 5 records per page for a given ID.  
E.g. Display 5 records per page where ID = 10000. And display until No more records matching criteria are found. PF7 - Should allow you to Traverse Backwards. PF8 - Should allow you to Traverse Forward.

Thanks!  
Senorita

---

<div class="post-metadata">

**Author:** ![Finn\_the\_Dane1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/finn_the_dane1/32/132_2.png) [@Finn\_the\_Dane1](https://techcommunity.softwareag.com/u/Finn_the_Dane1)\
**Post date:** [March 4, 2009, 3:34pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/6 "2009-03-04T15:34:43Z")

</div>

“1) Do we usually display records in ISN sequence?”

- well - how should I know ?! 😉  
I guess the answer is no ! but the ISN is of course important if you have a number of index-values that are identical.  
I recommend you use the documentation for the READ statement and also take a look at the example 7 “Starting with ISN”.

Building up own arrays is usually not necessary if you take advantage of the optional features of the READ statement.  
Finn

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [March 4, 2009, 5:04pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/7 "2009-03-04T17:04:00Z")

</div>

How many records will typically satisfy a given criteria?

If the number is “small”, say under 100, and if the user will typically be scrolling back and forth quite a bit, the array idea (with 100 entries, not 5) might be quite effective. It could save you from re-reading lots of records.

steve

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 4, 2009, 5:20pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/8 "2009-03-04T17:20:29Z")

</div>

Hi Again,

I am not sure may be I am going wrong somewhere. Here is the issue.  
When trying to execute the command  
READ(5) EMP-VIEW IN DYNAMIC #DIR SEQUENCE  
BY PLID = #VAR-N-V-PLIDI  
STARTING WITH ISN = 5

I am getting the error:  
“NAT3061 Error in search buffer. DB/FNR/Subcode :1:/:2:/:3:.”

PLID is my descriptor and presently I have hardcoded the ISN value. Irrespective of that ISN statement I am stll getting the same error.

May I know what is syntactically wrong here?

Thanks!

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [March 4, 2009, 5:59pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/9 "2009-03-04T17:59:28Z")

</div>

Is #DIR defined as an A1 variable? Does it have a value of A or D?

steve

---

<div class="post-metadata">

**Author:** ![Finn\_the\_Dane1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/finn_the_dane1/32/132_2.png) [@Finn\_the\_Dane1](https://techcommunity.softwareag.com/u/Finn_the_Dane1)\
**Post date:** [March 4, 2009, 6:09pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/10 "2009-03-04T18:09:28Z")

</div>

## Simmi - You should have a look at the examples The clip below is from the examples in lib SYSEXV where my line with #DIR was taken from… Finn

- Version .. 4.1
- 
- Functionality: Show new DYNAMIC SEQUENCE clause in READ statement
- 

```
           Note: Adabas V7 file is required                       

```

- 

* * *

- 

DEFINE DATA  
LOCAL  
01 EMPLOYEES-VIEW VIEW OF EMPLOYEES  
02 FIRST-NAME  
02 NAME  
01 J (I2)  
01 #FIRST (A15/1:6)  
01 #NAME (A15/1:6)  
01 #DIR (A1)  
01 #DIR-TEXT (A30)  
01 #START-NAME (A15)  
01 #START (L)  
END-DEFINE

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 5, 2009, 8:40am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/11 "2009-03-05T08:40:23Z")

</div>

Hello,

Good Morning!

I did walk through the example V3-RISN, before actually writing this code.  
But it din’t work. Finn’s post said that we should have Adabas V7 file.

We have installed Adabas Community Edition - Version - V6.1.4.04. Is this causing a problem?

I have declared #DIR as 1 #DIR (A1)  
It has been temporarily assigned value #DIR := ‘D’

Additional Info:  
My descriptor PLID is numeric - (N5). It has a value for which there are enough number of records in the database.

And the code is as follows:

RD1. READ(5) EMP-VIEW IN DYNAMIC #DIR SEQUENCE  
BY PLID = #VAR-N-V-PLIDI

Increment the Index…  
Follwed by move statements…  
&  
End-read

But it still gives the same error - NAT3061 Error in search buffer

Thanks!

---

<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:** [March 5, 2009, 9:39am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/12 "2009-03-05T09:39:08Z")

</div>

A NAT3061 indicates that there is a problem in what is being searched by - in this case, PLID. This is sometimes caused by a mismatch between was is defined to the database and what is defined in the DDM - some examples include: the field is not defined as a descriptor to the database, but is marked as a descriptor in the DDM; mismatch of formats - format A on the database and numeric in the DDM.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [March 5, 2009, 5:05pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/13 "2009-03-05T17:05:01Z")

</div>

As a follow-up to Douglas’s post, try:

RD1. READ(5) EMP-VIEW BY PLID = #VAR-N-V-PLIDI

If there is a mismatch problem between the fdt (adabas’s file definition) and the ddm (natural’s file definition), it should show up here as well.

Your syntax is absolutely correct. I ran:

RD1. READ(5) MYVIEW IN DYNAMIC #DIR SEQUENCE  
BY NAME STARTING FROM #START

WHERE:

DEFINE DATA LOCAL  
1 MYVIEW VIEW OF EMPLOYEES  
2 NAME  
2 CITY  
1 #DIR (A1) INIT \<‘A’\>  
1 #START (A20) INIT \<‘C’\>

So it looks like Doug’s analysis will prove correct.

steve

---

<div class="post-metadata">

**Author:** ![senorita](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@senorita](https://techcommunity.softwareag.com/u/senorita)\
**Post date:** [March 6, 2009, 9:12am UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/14 "2009-03-06T09:12:40Z")

</div>

Thanks a lot Douglas!!!

Thanks Steve to you too…

This works fine for me now…Yes PLID was a descriptor in DDM but not in database and hence it was causing a problem.

Thanks a lot poeple!

Regards  
Simmi

---

<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:51pm UTC](https://techcommunity.softwareag.com/t/pf7-pf8-query/80382/15 "2021-04-02T14:51:36Z")

</div>


