×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

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