× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Paul

To reply to John's original post - there is still static declaration of variables even with SQL - take a look at a listing sometime with any prepare of an SQL statement. I will be doing the same, to verify what I think goes on. E.g., can I pass in any SQL statement and have it executed in RPG? I thought so, so that would not have compile-time I-specs generated, so far as I know.Would I have to use SQLDA stuff? Never have had to yet.

Now, I've written a handler for using our RPG2SQL product to read and write to remote databases like SQL Server or Oracle, using native RPG opcodes. I can envision something that COULD re-interpret things. E.g., any character field length less than that of the length found at compile time could be put into that field of the file. Similarly for numeric types - then you'd have to be aware of truncation possibilities.

A handler could be written to use regular embedded SQL on the i to get around the strict typing, in the manner suggested, I think.

All the documentation is available at developerworks, used to be an RPG Cafe, might be in the IBM i special location - zone, is that what they called it?

There are no APIs for handlers, there is a description of the parameters passed to the program or procedure that you specify on the HANDLER keyword. Get ready to play with pointers - and I do NOT mean the singers!

I'm happy to discuss this kind of thing off-list if you want - email me privately and we can get connected. (Do a reply all in your email client and you'll see my address, as well as the list address.)

HTH
Vern

On 9/6/2011 9:21 PM, Morgan, Paul wrote:
Barbara,

Beautiful, just add a HANDLER keyword to the file spec and recompile to get dynamic type conversion on the RPG I/O. Is there any public description of the APIs provided to the handler code by RPG so I could get a deeper understanding? Has anyone written a handler like that?

Thanks,
Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Tuesday, September 06, 2011 7:25 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Storing Numeric Values in the Database

On 2011/9/2 9:24 PM, Morgan, Paul wrote:
... I wish to code in RPG V using external database tables (not
files). No table formats embedded in the compiled code. Data
definition reinterpreted at run time. If you can do it with embedded
SQL why not also with the base RPG IV language? Maybe some set based
RPG external table opcodes. Maybe a simple change to a file spec
from external file to external table might be all the code change
required. Just one last recompile to RPG Nirvana.

Hmmm, does the new SPECIAL file spec do that?
Yes, I think you could do something like that with an Open Access file.
The RPG program would still be hard-wired to a particular layout of the
record format, but the OA handler could map that to the fields in the
actual record format, and it could give an error if a field required by
the program no longer exists, or if it changed in a way that the handler
couldn't handle.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.