MIDRANGE dot COM Mailing List Archive

Re: program to read pf in reverse order using cl/400 program


Not to beat a dead horse but....

Let's assume a physical file ARRSEQFILE exists with the following


Let us also assume that there are the following three records in ARRSEQFILE
(the values of field Text being shown):


To me, the next to easiest way to read these records in reverse order,
using CL, is to download the free base run-time option of Control Language
for Files (CLF). CLF can be downloaded from
http://www.powercl.com/clf/clfdownloads and all you will need to install is
the base option. Once downloaded you can then write the following program:

Dcl Var(&Text) Type(*Char) Len(50)
Dcl Var(&EOF) Type(*Lgl)

OpnFCLF FileID(ArrSeqFile) LvlChk(*No)
PosDBFCLF FileID(ArrSeqFile) Type(*End)
ReadRcdCLF FileID(ArrSeqFile) Type(*Prv) EOF(&EOF) +
DoWhile Cond(*Not &EOF)
SndPgmMsg Msg(&Text) ToPgmQ(*Ext)
ReadRcdCLF FileID(ArrSeqFile) Type(*Prv) +
EOF(&EOF) RcdBuf(&Text)

CloFCLF FileID(ArrSeqFile)

Assuming the preceding source is in member RDREVERSE of QCLSRC, you can
compile the program with CRTBNDCL RDREVERSE, run the program with CALL
RDREVERSE, and after the CALL you should see the following messages:


As I mentioned earlier, the above is the "next to easiest" way. The easiest
way, again to my thinking, is to use the CLF precompiler. But the
precompiler does have a charge associated with it and, as I don't want to
make this a marketing response, I'll just give the "free" answer :)

Bruce Vining (a developer of CLF)

This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2015 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact