× 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: Procedure prototypes
  • From: Jon Paris <paris@xxxxxxxxxx>
  • Date: Wed, 1 Jul 1998 07:04:00 -0400

Prototypes for _all_ procedures to be used within a program (regardless of
whether they are defined within the source or not) must be at the beginning of
the program.  This is because a PR serves to warn the compiler of how to
interpret later statements e.g. so that the compiler knows that
DayOfWeek(Today) refers to a subprocedure that takes a single parameter and
that it's not an attempt to reference the Today element of an array called
DayOfWeek.

/Copy is normally used for any PRs that need to be included in more than one
source.

There is no performance impact to using PRs (you could have thousands of
"unused" ones in a compilation) since they do not define any data i.e. no
storage is allocated because of them.

There is no need for an explicit IMPORT statement to be done for the procedure
- this is only needed for data items that are to be shared.  For procedures,
the compiler will issue an effective import request based on the fact that the
procedure was invoked within the module.  If you want to "see" this, do a
CRTRPGMOD on the source in question, then do a DSPMOD - hit enter a few times
and you'll come to the page containing the list of Unresolved imports.  Your
procedures should be right there at the top of the list.  Similarly, if you do
a DSPMOD on the module exporting the procedure you'll find it listed in the
Exported symbols list.

By the use of EXPORT (and also Binder language - but that's a whole other
story) you can control _which_ of your procedures can be accessed by the
"public" and which are "private" i.e. used only by other procedures in the
module.

Hope this helps.


Jon Paris - AS/400 AD Market Support - paris@ca.ibm.com
Phone: (416) 448-4019   -   Fax: (416) 448-4414
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 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.