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


This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].