Hi,
There is no read backward command in CL. You may be able to trick the CL into reading the file in reverse order by using OPNQRYF. If you do this, then you will *only* be able to read the file backwards in your CL.
Regards,
Martin Gilbert.
Or you can create an LF with descending key and use this file in your CL.
Rudolf
Last Wiki Answer Submitted: March 17, 2009 11:01 am by Gilly40023,625 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.
OPNQRYF there is a parameter Keyfield order, give *DESCEND in that.
2. First find the total number of records from RTVMBRD and Move that to field RRN. Then OVRDBF filename Pointer = &RRN. RCVF Rcdfmtname. Then RRN = RRN -1 again OVRDBF
3. Use an LF with descending Key and use this LF in the program.
Or use the command Read Record using CLF (READRCDCLF), which supports reading the previous record with TYPE(*PRV). The command documentation can be found here.
CLF provides a no-charge run-time which includes support for READRCDCLF.
Vendor response:
Your productivity can be improved by using the optional CLF precompiler, which does have a charge.
End of vendor response
OPNQRYF there is a parameter Keyfield order, give *DESCEND in that.
2. First find the total number of records from RTVMBRD and Move that to field RRN. Then OVRDBF filename Pointer = &RRN. RCVF Rcdfmtname. Then RRN = RRN -1 again OVRDBF
3. Use an LF with descending Key and use this LF in the program.
Or use the command Read Record using CLF (READRCDCLF), which supports reading the previous record with TYPE(*PRV). The command documentation can be found here.
CLF provides a no-charge run-time which includes support for READRCDCLF.
Vendor response:
Your productivity can be improved by using the optional CLF precompiler, which does have a charge.
End of vendor response
Bruce Vining