James,
Some years past I did something like what you are talking about, except
that application was only required to read. The main technique was to
have a pgm described file with a wide/long buffer.
Prior to opening the file the actual file's record format was retrieved
and used so data could be extracted from the input buffer. Not unlike
the popular DBU utility.
If the number of files is limited, today's LIKEREC keyword could be used
to good effect.
To your update question, I don't know if that fact may also be available
from DSPFD.ALWUPD or an API, and I guess it could vary by field/column?
I did a quick check of a local DDS logical and Sql view and DSPFD shows
ALWUPD *NO on the view and ALWUPD *YES on the logical, but I suspect
all logical fields in this file are not update capable, but I did not test.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Tuesday, October 02, 2012 4:16 PM
To: RPG programming on the IBM i / System i
Subject: Physical and Logical Files
Continuing with some RPG-specific questions on the scenario (substituting an SQL join-view for a PF) I've been discussing on the Midrange list:
Suppose we have an RPG program that's accessing the file natively. Since we only know part of the record structure at compile time (and don't actually need to know the rest of the record structure), we're treating it as program-described, and since we don't even know that the file exists in any particular installation at compile time, we're using USROPN.
But in this scenario, we don't, at compile time, even know whether the file is going to be a PF or a join-view.
I'm assuming that SQL join-views are like DDS join-logicals: they're read-only, at least through native RLA, and will throw an exception if you try to open them for update (correct me if I'm wrong).
Other than having separate F-specs, is there a way, in native RLA, to defer until runtime whether the file is opened for input or for update?
--
JHHL
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.