Scott...
Yeah, I guess I was thinking something more on the line of perhaps table
mapping or table field mapping, similar to how some of the conversion
utilities work...
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, October 21, 2009 4:35 PM
To: Midrange Systems Technical Discussion
Subject: Re: IBM i "Open I/O" Architecture
Hi Don,
RPG has a feature called "externally defined files". When you declare
an externally defined file, the RPG compiler reads the external
definition of those files at compile-time, and generates variables in
the RPG code that match the attributes of the columns (or "fields") in
the file.
Since RPG is a compiled language, and the variables used in an RPG
program must be established at compile-time, there's no way a run-time
routine can query the structure of the database to fill in the column
information.
The RPG compiler doesn't run your code at compile-time, so you can't
write a handler that would fill-in the external definition at compile time.
If you wanted to use a solution that does NOT automatically generate
variable names according to an external definition (such as a
program-described file, or by calling SQL routines that return data into
arbitrary variable names like my existing JDBCR4 srvpgm) then you could
indeed do what you describe... but I don't think it'd work the way
"regular" RPG programmers expect it to.
Don wrote:
Hey Scott...
Well, while we're looking at hypotheticals...why couldn't some API open a
commlink to a target box with a non-DB2, but supported, DBMS on it. Query
the structure and engines, open the table desired, as desired, then use
SQL
constructs to do I/O remotely and pass the items across in the same
concept
that we use remote databases on the AS/400 now??
DR2
As an Amazon Associate we earn from qualifying purchases.