×
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.
It is imho possible to code level-check-immune RPG. That is if you use SQL for access and also always list the columns you select (not "select *") fields can be added (or dropped for that sake) from the table without disturbing the program.
Med vänlig hälsning / Best regards
Åke H Olsson
-----Original Message-----
From: Jeff Crosby [mailto:jlcrosby@xxxxxxxxxxxxxxxx]
Sent: den 1 november 2012 17:43
To: RPG programming on the IBM i / System i
Subject: Could RPG become quasi-immune to level checks (was: Are level checks still useful?)
The reason you don't have level checks in PHP (and similar
environments) is because they don't have hard-coded from/to positions
in fields in the record. When you compile an RPG program, the
compiler reads the external definition, and hard-codes the from/to
positions of fields in the record into the program. You have to
recompile for it to update these -- and therefore, level checks are an
important safeguard. Without them, if the file changes, you'll end up
reading (or worse, writing) incorrect data at incorrect places in the record, causing a big huge mess.
Scott's post got me thinking.
Theoretically, could RPG be enhanced such that the from/to positions are _not_ hard-coded at compile time? Instead, based on field name (whether renamed or not), the from/to positions would be established at run time.
If so, one would also have to code updates properly, i.e., either via "Update RecordName %Fields(blah:blah:blah);" or making sure the O specs have no end position.
Even though I have absolutely no experience whatsoever in compiler writing (and don't want any), I can imagine how this would fundamentally affect the compiler.
--
Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com
The opinions expressed are my own and not necessarily the opinion of my company. Unless I say so.
As an Amazon Associate we earn from qualifying purchases.