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?
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.
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.
Thanks for the quick reply. Is the approach undertaken by me a right approach?
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.
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?
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.
“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
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.
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.
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.