5 pts.
 Read backword in CL/400
How to read backword a physical file in CL400.

Software/Hardware used:
ASKED: March 16, 2009  6:45 AM
UPDATED: April 5, 2012  11:11 PM

Answer Wiki:
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  Gilly400   23,625 pts.
All Answer Wiki Contributors:  Gilly400   23,625 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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.

 1,880 pts.

 

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

 6,055 pts.