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


  • Subject: Re: RPG IV program - comments requested
  • From: "Peter Dow" <pcdow@xxxxxxxxx>
  • Date: Fri, 24 Sep 1999 23:25:53 -0700

> The procedure interface is the equivalent of the *ENTRY PLIST with the
addition
> that the compiler will validate it. The validation is performed by
comparing the
> definition of the procedure interface (PI) against the definition in the
> prototype (PR).

Isn't that like having to enter your password twice? Although in the case of
a password, one can excuse the redundancy because you can't see what you're
typing. Putting the same exact code in two places so that one can be
validated against the other?

> On the same basis, in a calling module the compiler will validate the call
> statement (CALLP or EVAL) against the definition in the prototype. Hence,
since
> the prototype will be required in many modules (each calling module and
the
> module in which the called procedure exists) it is best to have only one
copy of
> it and include it where required, using /COPY.

Now this I can understand as a way to prevent run time errors (although I
certainly hope it doesn't mean they don't do parameter checking at run
time -- what if the called procedure's interface changed?)

> The reason that the compiler does not look at the called program is that
the
> called program may not yet exist. The validation is performed on the
CRTRPGMOD.

Ok, that makes sense to me too. Thanks!

> I amn't quite sure that the version of the /COPY is an issue. If you are
using
> the wrong version, the module will not be created.

Why is that? As long as every CALLP or EVAL conforms to the prototype in the
/COPY, the compiler will be happy. And you just said it doesn't check the
program since it may not have been created yet. Therefore, you will only
find the problem when running the program. Again, assuming that it still
does parameter checking at run time.

Or wait, have I got that wrong? Are called procedures bound with the calling
program at CRTBNDxxx time? Are the parameters checked again at this time?

I hope I don't sound like I'm arguing about how we have to do it to make it
work. I'm just trying to understand the reasoning behind it. Having the
compiler doing some additional checking to make sure the correct size and
type of fields being passed as parameters is not a bad thing, although there
is still room for error. On the other hand, in my many years of programming,
problems caused by passing the wrong parameters have been few in number, and
usually not to hard to find.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.