|
I may have found the answer to my first question. The manual says "Static
calls
allow operational descriptors..." implying that a non bound call cannot pass
operational
descriptors.
This probably seems obvious to the guy who wrote the compiler but I am still
unsure about the correct way to prototype a main procedure. How does the
compiler
determine the export name? The manual says "If EXTPGM is specified, then an
external program call is
used; if EXTPROC is specified or if neither keyword is specified, it will be
called by using a
procedure call." I can't display a program and see the procedure exports, so
how do I
determine what name is used? Is it the uppercase name specified for the
procedure interface and
prototype? Main was probably not a good idea because of the possibility of
duplicate exports.
The loop that I found when you specify Begin and End procedure statements
should have been
caught by the compiler. The manual says "...only procedure with a complete set
of specifications
available (except the P specification)" implying that "P" specs are not
allowed. It does seem
odd that you can't code a begin or end procedure just because it is a main
procedure. Kind of
like not allowing ProcNam() when no parameters are passed.
The manual also says "You cannot define return values for a main procedure,
nor can you specify that its parameters be passed by value." Why doesn't the
compiler check for this, or is this incorrect?
Thanks,
David Morris
>>> David Morris <dmorris@plumcreek.com> 03/16 6:02 PM >>>
Can anyone tell me how to specify operational descriptors for a main procedure.
I have
OPDESC on the prototype and procedure interface but get an error "operational
descriptors
not passed" when the program is called. Is this because you can't pass
operational
descriptors to a main procedure? This procedure is an OPM interface to a
sub-procedure
that receives highly variable parms. I have found that callprc to a
sub-procedure does
pass operational descriptors. I may just have to use %len(%trimr()) to set the
length and
require that they be declared at the maximum width in OPM programs.
%len(%trimr()) for a
long field takes a hemosecond to execute.
Can anyone tell me the "correct" way to specify a main procedure with a
prototype? The
manual is vague. I have settled on the name Main for the prototype and
procedure
interface. I also found a that a main procedure will loop if you specify a
begin and
end procedure. Found that through trial and error while trying to get the
OPDESC to
work. This means that a main procedure cannot be used as a sub-procedure.
One more question. What is the best way to pass omittable parms through a
program?
I don't understand why a parameter passed by reference can't just be passed
through
to a another procedure with the associated descriptors, etc. intact. Is there
a trick?
All I get is a reference to a parameter not passed. Depending on the number of
omittable parameters I have had to code up to 25 different calls in a case
statement. In
another case I had to use subroutines and copy source because there would have
been hundreds of possible combinations.
Thanks,
David Morris
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List! To submit a new *
* message, send your mail to "RPG400-L@midrange.com". To unsubscribe *
* from this list send email to MAJORDOMO@midrange.com and specify *
* 'unsubscribe RPG400-L' in the body of your message. 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.