• Subject: FW: Prototype in RPG/ILE
  • From: "Karen Summers" <ksummers@xxxxxxxxxxxxx>
  • Date: Wed, 9 Feb 2000 19:38:29 -0800
  • Importance: Normal

This the standard that has been recommended to me as well.
Karen

-----Original Message-----
From: owner-midrange-l@midrange.com
[mailto:owner-midrange-l@midrange.com] On Behalf Of Eric N. Wilson
Sent: Wednesday, February 09, 2000 11:54 AM
To: MIDRANGE-L@midrange.com
Subject: Re: Prototype in RPG/ILE


The function prototype is basically the PLIST for the procedure. I would
recommend placing this in a copy source member with the same name as the
procedure. For example say I create a procedure called Center which takes a
32740 char varying const and a 32740 varying output field and returns an
indicator type variable for successful completion or not.

In my copy source file (I use QCPYLESRC) I would have a member called Center
that would have the following in it.
D Center                        PR                    N
D  StringToCenter                    32740    Varying Const
D  ResultString                         32740    Varying Options(*VarSize)

Then in my real source file I would have the following

/COPY QCPYLESRC,Center

P Center                      B                            Export
D Center                        PI                    N
D  StringToCenter                    32740    Varying Const
D  ResultString                         32740    Varying Options(*VarSize)
D* Local variables follow:

C* Do some worthwhile stuff here

P Center                      E


You will notice that the PR and the PI Sections look the same, This is by
intent. The PR serves as a hint to the compiler that this given function
accepts these parameters and then the compiler is able to make sure that you
are passing the right types/lengths at compile time rather than going boom
at run time. I believe it to be very good practice to include the copy
source member into the member that describes the procedure. That way if you
get them out of sync and you try to recompile you will get an compile error.

The only time I would not use a copy source member is when the routine is
absolutely not going to be used anywhere else period. (A very seldom
occurrence indeed).

I hope this helps a little
Eric



______________________________________________
Eric N. Wilson
President
Doulos Software & Computer Services
2913 N Alder St.
Tacoma WA 98407


----- Original Message -----
From: "Bruce Collins" <bacollins@twitchellcorp.com>
To: <MIDRANGE-L@midrange.com>
Sent: Wednesday, February 09, 2000 9:53 AM
Subject: Prototype in RPG/ILE


> I am trying to learn to use Subprocedures instead of Subroutines in
RPG/ILE.
> I am having a problem understanding What the purpose of the Prototype and
> its relationship to the procudure. Could someone shed some light on this
> please.
>
> TIA
>
> Bruce Collins
> MIS Manager
> Twitchell Corporation
> 4031 Ross Clark Circle NW
> Dothan, AL 36303
> bacollins@twitchellcorp.com
> (334) 792-0002 x 1266
> (334) 673-4121 Fax
>
> Opinions expressed do not necessarily represent those of my employer or
> anyone else.
>
> **** NOTE TO RECRUITERS ****
> I nor anyone that I know of is interested in any new and/or exciting
> positions. Please do not contact me.
>
> +---
> | 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
> +---

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

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