PF7/PF8 QUERY

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

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!

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

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!

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

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

  • well - how should I know ?! :wink:
    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

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

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!

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

steve

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

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!

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.

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

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