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



On 6/26/2013 6:45 AM, Brian Parkins wrote:
...
The following example works perfectly well - now that we can specify EXTPGM
on the PI in Program B. Yet the code appears to contradict the Manual.
========================================
// Module/program name is PROGRAMA
D CallParms Pr ExtPgm('PROGRAMB')
...
========================================
// Module/program name is PROGRAMB
// No Prototype (PR)
D EntryPlist Pi ExtPgm('PROGRAMB')
...
========================================
...
I agree wholeheartedly that using /COPY to embed the PR in both programs
is desirable for building more robust code. (I do come across
installations where standards expressly forbid the use of /COPY - hence
another appeal of the V7.1 enhancements.)

Brian, you're right that it's possible to code that way. The manual isn't talking about rules that can be enforced, it's talking about rules that should be followed.

I don't think it's a good idea to make it easier for new prototype-ers to just put the PR in the caller and omit the PR in the callee.

You already need two source members for the lesson anyway. Adding a third one with the copy file is not that big a deal.

I think we should start right off with the one-and-only prototype in the copy file, and explain to the students that the prototype's main purpose is to ensure that the procedure and its caller both have the same idea about the return type and parameters, and that the only way to ensure this is for them to use the exact same prototype in the exact same source member.

If you only focus on the caller side of the prototype, you have to teach a more complex and frustrating lesson later about why they really should put the prototype in a copy file and copy it in.

Analogy: Teaching someone to drive a car, and teaching them about seatbelts on the second lesson.


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.