|
I have a hard copy autographed by Jon Paris and Susan Gantner. What area
are you pointing me to?
Rob Berendt
==================
Remember the Cole!
Anton Gombkötö
<gombkoetoe@ASSOF To: RPG400-L@midrange.com,
RPG400-L@midrange.com
T.COM> cc:
Sent by: Subject: Re: Naming /copy
prototype members.
owner-rpg400-l@mi
drange.com
03/26/01 12:22 PM
Please respond to
RPG400-L
Hi Rob!
First of all:
Have you already downloaded the redbook "Who knew you could do that with
RPG?"
http://www.redbooks.ibm.com/abstracts/sg245402.html
It's worth (almost) any online fee and also worth registering. Don't forget
to download the "additional material" with a save file with all the
examples in it.
- - -
>Ok, so I decide I want to create prototypes for external programs.
Great!
>I want to use /copy.
Great!
> I thought of having a separate member for each programs
>prototype. If I do this what should the member name be? Or is this
>something better handled by Conditional Compilation?
When you really use a prototype per program, then i'd call the member the
same as the program is called. That should make life a bit easier. (You
need to hold the prototypes in another source file then, like QPTSRC or
QCOPYSRC or whatever you like.)
But it's also possible to hold all prototypes in a single source member.
The compiler just picks those he needs; this reduces no overhead.
- - -
>For example, let's say we have the program XYZ123. And this program had:
>C *ENTRY PLIST
>C PARM PHONE 15
>C PARM FAX# 30
>
>Now I change this to:
>D XYZ123 PR
>D PhoneNbr 15A
>D Faxing# 30A
> * Replaces *ENTRY PLIST
>D XYZ123 PI
>D Phone 15A
>D Fax# 30A
There's something wrong with your prototype; i think you mixed up some
things. A procedure (or a function) can only have a single return value,
which is the procedure interface. I assume you wanted to tell the compiler
/ your coworkers that both parameters could be changed by XYZ123.
The prototype should just look like this:
D XYZ123 PR
D PhoneNbr 15A
D Faxing# 30A
That would be fine for a procedure. As you told us that XYZ123 is an
external program, you have to use EXTPGM.
D XYZ123 PR EXTPGM('XYZ123')
D PhoneNbr 15A
D Faxing# 30A
This leads to a dynamic call at run time, just as if it was a CALL.
- -
The other thing is the PI thing.
You need this when you write your own procedures, not for calling external
programs.
Let's assume XYZ124 is a procedure.
Then i'd have the prototype
D XYZ124 PR
D PhoneNbr 15A
D Faxing# 30A
in a copy. In the source, where you code the procedure, you'll have
P XYZ124 B
D PI
D PhoneNbr 15A
D Faxing# 30A
C* processing
P E
Mind the P in column 6! The two lines tell us where the procedure "B"egins
and where it "E"nds.
- - -
>Or is it better to leave the PR in XYZ123 and use conditional compilation
>to just pull in the prototype? If so, how?
>
>I try to put the comment * Replaces *ENTRY PLIST, in there for the people
>who scan for this.
But they won't see it; unless they scan the spooled file. And then it's in
the wrong place. When you call, say, seven external programs this way,
you'll have seven comments like that - and one usually has only one *ENTRY
PLIST in a program. That would And there it makes more sense to scan for
the program's name...
Do keep the prototypes in copies; otherwise the advantage of easier
parameter change is gone. For your purpose you do not need conditional
compiling.
- - -
>==================
>Remember the Cole!
Just curious: what does that mean?
Mit freundlichen Grüssen / best regards
Anton Gombkötö
Avenum Technologie GmbH
Wien - Mattsee - Stuttgart
e-mail Office : mailto:Anton.Gombkoetoe@avenum.com
Homepage : http://www.avenum.com
Lest das Redbook / read the redbook "Who knew you could do that with RPG?":
http://www.redbooks.ibm.com/abstracts/sg245402.html
+---
| 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 mailing list archive is Copyright 1997-2025 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.