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



Hi Trevor,

On 11/1/2012 11:20 AM, Briggs, Trevor (TBriggs2) wrote:
Of course, if you remove all external data definitions (including SQL
variable LIKE definitions), and then subsequently change a field
attribute, you will be looking at program code changes rather than just
recompiles. Swings and roundabouts.


Not necessarily... If you don't change the code, SQL will assign the data to the old field size. If you made an alphanumeric field smaller, that means it'll be truncated. If you made a numeric field smaller, that means you run the risk of a "receiver too small" error, but only if the value of the field is too high for the old field size.

Since you're program-describing the field in the first place, you could just make the field larger than you'll ever need. For example, a field for an employee name might be 20 chars long now in the database. You could code your RPG program with a 256 character field -- maybe overkill -- but nobody will ever have a name that long. Maybe in 6 months someone will say "20 chars is too short" and change it to 40... no problem, it's still less than 256, and the RPG program will work fine. No recoding necessary.

That's essentially what's happening in PHP. Each variable is either a floating point number, or a variable-length ("varying" in RPG) string with a very long maximum length.

You can do the same thing in RPG.. should be no problem. The only key is you really need to use SQL for the I/O, (not native record I/O)

Of course, you might have to change DDS for screens/reports (or O-specs, maybe) but you could very well have the same problem in PHP, too, if you're using fixed-width columns for something.

So, there's really nothing stopping you from coding RPG the same way as PHP -- nothing except, perhaps, a mental block. :-)

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.