× 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.



John,

Why isn't it suited? RPG throws errors on file level checks when the table format changes. It can't do the same for a missing or changed column? Don't you get warning or hard errors with embedded SQL?

Catching type errors as soon as possible is the point. At compile time instead of run time is better if you can do it. That can be done with a static typed code variable linked to a static database column type. I'm not really wishing for dynamic typing in RPG. I want dynamic data conversion between a current database column type (checked at compile time and rechecked at run time) to a static code variable type (set at compile time). RPG already does a lot of automatic type conversions so why isn't this possible? Maybe that conversion fails with an error if the column disappears or has the type changed too much at run time.

Isn't embedded SQL a better Frankenstein analogy? Two different languages stitched together.

Paul Morgan

Principal Programmer Analyst
IT Supply Chain/Replenishment

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John Yeung
Sent: Friday, September 02, 2011 10:02 PM
To: Midrange Systems Technical Discussion
Subject: Re: Storing Numeric Values in the Database

On Fri, Sep 2, 2011 at 9:24 PM, Morgan, Paul <Paul.Morgan@xxxxxxxxxxx> 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.

I think the base RPG language isn't well-suited for that level of
dynamicism. The compiler needs to account for all the names and their
types (including their size). If you wrote a program that used a
name, and that name either disappeared or changed its type after you
compiled it, then what was the point of compiling it? This is the
very thing that static typing proponents point to as an advantage of
precompiled programs.

The fact that you can embed SQL *is* the mechanism by which RPG allows
dynamic data definition. Frankly, I don't think it's worth mangling
RPG into more of a Frankenstein's monster than it already is.

If you are after full dynamic typing, then you are probably better off
with another language. One that is not statically typed. SQL itself,
for example. If you prefer a dynamic procedural/object-oriented
language, there is iSeries Python.

John

As an Amazon Associate we earn from qualifying purchases.

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-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.