There is no Paticular Opcode in CL for Reading Lower and Higher Record.
But, You can do this by Ordering the File in Required Order using OPNQRYF.
Eg:- If you want to Read the lower Record, You will need to create the logical view for the file in Ascending order of key field.
<pre>OPNQRYF FILE(TESTPF) KEYFLD((KFLD01 *ASCEND *N)) </pre>
If you would like to Read the Higher Record, Then, You will need to create logical view for the file in Descending order.
<pre>OPNQRYF FILE(TESTPF) KEYFLD((KFLD01 *DESCEND *N)) </pre>
You can Read the file(TESTPF) using RCVF in CL. The First Record will be the Required Record(Lower or Higher based on key field).
Pradeep.
Last Wiki Answer Submitted: December 16, 2011 12:24 pm by deepu93213,370 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
You want to set, which means Read(or you dont want to read the Record?)
I have mentioned to lower record by keeping file in Ascending order and Higher Record by keeping Descending order.
Only, One time Read will be fine, you will no need to read in sequence.
If its not the Required answer, let me know with little more explanation regarding Set Lower & Higher Record.
Set, I don’t understand what you mean by the use of the word set.
Perhaps, setting the range of values that will be processed by a called RPG program?
Read the first and last record in CL – that I understand, although, I cannot imagine why you would want to do that and, as discussed by others, CL isn’t a good tool to do that in. Would you want the physical first and last records or the records with lowest and highest value in a particular field. How many records would be in this file?
Pradeep, you gave me, order wise reading operation…
i want to set lower record and higher record in clle program…
I didnt get you exactly.
You want to set Lower and Higher Record.
You want to set, which means Read(or you dont want to read the Record?)
I have mentioned to lower record by keeping file in Ascending order and Higher Record by keeping Descending order.
Only, One time Read will be fine, you will no need to read in sequence.
If its not the Required answer, let me know with little more explanation regarding Set Lower & Higher Record.
Pradeep.
CL is not designed to do what you are asking.
You can read a file sequentialy but not randomly with just CL
You could try variations of OVRDBF with different values for the POSITION() parameter.
Tom
Set, I don’t understand what you mean by the use of the word set.
Perhaps, setting the range of values that will be processed by a called RPG program?
Read the first and last record in CL – that I understand, although, I cannot imagine why you would want to do that and, as discussed by others, CL isn’t a good tool to do that in. Would you want the physical first and last records or the records with lowest and highest value in a particular field. How many records would be in this file?
Why must this process be done in CL?
Phil