Not to beat a dead horse but....
Let's assume a physical file ARRSEQFILE exists with the following
definition:
R ARRSEQRCD
TEXT 50
Let us also assume that there are the following three records in ARRSEQFILE
(the values of field Text being shown):
1st
2nd
3rd
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:
Pgm
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) +
RcdBuf(&Text)
DoWhile Cond(*Not &EOF)
SndPgmMsg Msg(&Text) ToPgmQ(*Ext)
ReadRcdCLF FileID(ArrSeqFile) Type(*Prv) +
EOF(&EOF) RcdBuf(&Text)
EndDo
CloFCLF FileID(ArrSeqFile)
EndPgm
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:
3rd
2nd
1st
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.
As an Amazon Associate we earn from qualifying purchases.