× 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 2019-04-26 6:51 PM, Stuart Rowe wrote:
I always wondered why there is a "name" on a procedure interface. ...
Can anyone show an example of where a non-*N name is absolutely necessary
(and meaningful)?


In most cases, the name of the PI is the same as the name of the procedure, so *N is fine for the PI.

The only time you need a name is for the cycle-main procedure where you have a prototype in a /COPY file. The compiler needs the name on the PI to know which prototype to use.

In the following example, the "incorrect program"has *N on the DCL-PI, so the compiler doesn't know that it had to match the MYPGM prototype that was copied in, and it wouldn't detect that the parameter for the PI doesn't match the parameter for the PR.

The "correct program" has a name for the PI, so the compiler can match the PI with the PR and detect the error.

/COPY file MYPGM_PR:
dcl-pi mypgm;
p1 char(10) const;
end-pi;

Incorrect cycle program with *N on the PI:
/copy MYPGM_PR
dcl-pi *n;
p1 char(20) const; // compiler doesn't flag parm mismatch
end-pi;

Correct cycle program with a name on the PI:
/copy MYPGM_PR
dcl-pi mypgm;
p1 char(20) const; // compiler flags parm mismatch
end-pi;



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.