× 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: Chris Bipes <ChrisB@xxxxxxxxxxxxxxx>
  • Date: Fri, 24 Sep 1999 16:05:13 -0700

Actually, for your main program you must put all your global definitions at
the top, which will include your prototypes.  You can code your procedures
at the bottom of the program, after all subroutines.  This puts your pi's at
the bottom and pr's at the top.  Within your procedures, you can code D
specs for local variables and even include subroutines.  Basically a program
within a program.  This may not be a good practice though.  I code the
procedures separately or as related groups into nomain modules.  Combine the
modules into a service program and add service programs to a binding
directory.  I then create a prototype source for each service program with a
note as to which binding directory the service program is placed.  Yes I
agree that putting the Prototype and the Procedure interface in the same
source member is tedious and I am sure IBM could eliminate for nomain
modules with not too much overhead in the compiler.  But then the compiler
will catch differences between the PR and PI so you can correct them.

-----Original Message-----
From: Jim Langston [mailto:jlangston@conexfreight.com]
Sent: Friday, September 24, 1999 1:17 PM
To: RPG400-L@midrange.com
Subject: Re: RPG IV program - comments requested


I *think* I understand...

A prototype tells the compiler how to expect the program to be called, so
that
when it is compiled it only has to make one pass, instead of two.

And then, the Program Interface is the declaration of how it is being used.
I
understand it, because it is done in PC languages extensively, such as C and
Pascal.

The Prototype is only needed for the compiler, if you had many callable
subroutines
in your source code, you would put all the Prototypes at the top, but put
each
program
interface by each subroutine?  Wait, that doesn't make since, since all D
specs
have
to be declared at the top of code anyway!

Also, I don't think it would be a good idea, if using the /COPY, to use
external
definitions for the prototype, since another program that /COPYes the file
in may

not use the same files, so won't have the definition for the variable.

Am I right in all this?  Since this is all new to me anyway.

Regards,

Jim Langston

Peter Dow wrote:

> Can someone please explain why the repetition between the prototype and
> procedure interface? The ILE RPG manual has the following definitions:
>
> "A prototype is a definition of the call interface."
>
> "A procedure interface definition is a repeat of the prototype information
> within the definition of a procedure."
>
> Why all the repetition? Assuming there's a reason, then I suppose IBM's
> recommendation for using COPY's is a good one, although I have not used
> those for years because they tended to make it difficult to find a
statement
> number in source code from the one given in an error message, a problem
> which cropped again when I started using ILE RPG. In most cases now it is
> necessary to use STRDBG to find the actual statement in the source code
> given a statement# in an error message.
>
> Also, aren't external definitions preferable? As in:
>
> D*  First the prototype
> Dprogramname      pr
> DTrailer                                              LIKE(BSXTRL)
> DSCACCode                                    LIKE(SCACCode)
> D* Now the procedure interface
> Dprogramname      pi
> DTrailer                                              LIKE(BSXTRL)
> DSCACCode                                    LIKE(SCACCode)
>
> Regards,
>  Peter

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