Hi Adam,
It depends.
If this is a one-time positioning, you can use OVRDBF with it's
POSITION. OVRDBF, as you probably know, only affects the way a file is
opened -- so you can open a file with the cursor already positioned to a
given place in teh file, then read from there.
But once it's opened, OVRDBF can't be used to re-position it. In RPG
with SETLL you can reposition the file as much as you like. Not so with
OVRDBF, because OVRDBF only has impact at the moment the file is opened.
Another approach is to forget about CL's DCLF/RCVF (which has never been
very feature rich) and use the ILE C _Ropen, _Rread, _Rlocate, etc,
APIs. As of V5R4, CL has enough ILE functionality that it can call
these directly with CALLPRC.
Years ago, Peter Clifford wrote a set of RPG wrappers for _Ropen(), and
turned it into a set of CL commands. So the backend of these *CMD
objects is written in RPG, but once installed, you can use them to do
all sorts of file access from CL. This was published in System iNEWS
magazine... here's a link to the article (requires a ProVIP membership):
http://systeminetwork.com/article/cl-flexes-its-database-muscles
Finally, you could consider using SQL. I sometimes will use QShell's
SQL and have it output to a data queue that I read from my CL program.
That way, I can do as much positioning, read, write, etc as I want. But
it's cumbersome from the perspective that I can't use the file's
external description for the data queue -- so I tend to limit it to flat
files or queries where I only need a single field.
But, anyway... one of those options should work for you. (If not, use RPG!)
Adam Glauser wrote:
I have this feeling that I read about a way to do the equivalent of
RPG's SETLL (which the positions to a record by key or RRN) with CL
commands.
I can't remember anything other than that, and my searching by topic and
the keyword 'file' in the Infocenter isn't helping (surprise!).
Is there such a method, or am I just haverin'?
TIA,
Adam
As an Amazon Associate we earn from qualifying purchases.