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



When the procedures are in the same source that they are being used in then the PI is used to validate the call. So the validation aspect still exists.

For simplicity, the initial rule (from V3R2) was that prototypes were always needed. As of V7 (actually I thought it was V6 but ....) prototypes are only needed when the compiler has no other way of determining the parameter rules.

While a terrific change for cases where procedures are used as building blocks within a program, this relaxation has caused a problem (as discussed earlier in the thread) because there were actually _two_ reasons for using prototypes. The first was to validate the call - the second (in the source that defined the procedure) was to validate that the prototype accurately reflected the procedure interface. With the relaxation in the rules it is no longer compulsory to include the prototype in the defining source and that can lead to errors when some sloppy programmer changes the prototype and does not change the procedure itself.

There is now an RFE out there that is asking IBM to enforce prototype usage in cases where a procedure is exported. It won't provide a 100% solution because it could still be circumvented but it would be a big help which why I immediately voted for it.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Mar 3, 2018, at 4:30 PM, Dave <dfx1@xxxxxxxxxxxxxx> wrote:

Hello,

I left the i a few years ago on V6.1. I'm back again and we have 7.3 and
I've just discovered that the prototypes were no longer needed in the
source member where the procedures are defined. So, I'm missing something.
I thought that having a prototype forced me to get my parameters right. In
this particular case, what was the point of having the prototype?

2018-03-01 11:45 GMT+01:00 Thomas Raddatz <thomas.raddatz@xxxxxx>:

Hi Barbara,

I opened RFE "http://www.ibm.com/developerworks/rfe/execute?
use_case=viewRfe&CR_ID=117030" to address the problem.

Regards,

Thomas.

-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Thomas Raddatz
Gesendet: Dienstag, 20. Februar 2018 08:52
An: RPG programming on the IBM i (AS/400 and iSeries)
Betreff: AW: 7.1 and RPG prototypes

Hi Barbara,

The procedure was called by another module, but it was also called
internally. And when sombody changed the procedure interface, he forgot to
change the prototype. Before that somebody else forgot to include the /copy
with the prototype to the module containing the callee. Everything compiled
fine, but the call from the external module did not work because of a
parameter mismatch. The last parameter contained nothing but garbage and I
wondered why.

I took me too long to find the problem, because I did not think at the
prototype.

Opening a RFE is a good idea.

Thomas.

-----Ursprüngliche Nachricht-----
Von: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Barbara Morris
Gesendet: Montag, 19. Februar 2018 22:25
An: rpg400-l@xxxxxxxxxxxx
Betreff: Re: 7.1 and RPG prototypes

On 2018-02-19 9:23 AM, dlclark@xxxxxxxxxxxxxxxx
wrote:

In my experience, although prototypes are no longer required
for internal procedures, the compiler still requires a prototype for
external stored procedures or it gives a compile-time error that the
procedure is undefined.

That's true of a module that is calling a procedure in another module.

But a prototype isn't required within the module that is exporting the
procedure.

Thomas, the reason that the compiler doesn't require a prototype is that
it the procedure may not ever be called from another RPG module.

It wouldn't be possible for the compiler to change its rules and start
requiring a prototype for exported procedures. But you could open an RFE to
request an H spec option to require prototypes for programs and exported
procedures.

--
Barbara

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the
sender.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a criminal
offence. Please delete if obtained in error and email confirmation to the
sender.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: http://amzn.to/2dEadiD


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.