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



Thanks Scott.  I think I understand it now.  

Rick

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Scott Klement
Sent: Thursday, July 22, 2004 1:37 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Definition not found for internally defined procedure



Hi Rick,

It might help to keep firmly in mind that there's two stages to compiling
an ILE program (regardless of it's language) compiling the source (Which
generates a *MODULE) and binding modules together (which generates a *PGM
or *SRVPGM)

> I'm not seeing an explicit reference to 'CMPVAL' in the code.  Either in
> the source or the previous message.  Are you referring to the conversion
> mentioned farther down in your message?

In the absense of the EXTPROC keyword, the RPG compiler converts
subprocedure names to all caps.  So, when you posted code that had a
PR/PI without an EXTPROC, my mind immediately saw it as 'CMPVAL'.

All the RPG compiler does with these names is put them in a table of
symbols.  Remember, the actual resolving from names to addresses is not
done by the compiler, it's done when the program is bound.


> Removing the quotes worked but I'm not sure I'm following all of this.
> Where is it searching for a prototype?  I thought it searched the source
> first before going to binding directories.  I compared the prototype to
> the definition many times to check for stuff like case to make sure they
> matched.  I'm confused as to why the compiler didn't match them up.

Okay, here's the rub...   %paddr() works two different ways:

%paddr(PrototypeName)

When you don't put the name in quotes, the RPG compiler looks for a
prototype with that name, and uses whatever procedure that prototype
happens to point to.

In your example, the CmpVal prototype called a procedure called 'CMPVAL',
because that's what the RPG compiler would've exported the symbol name as
-- RPG converts subprocedure names to all caps.


%paddr('ProcedureSymbolName')

When you put the name in quotes, %paddr() refers to the actual PROCEDURE
name instead of the prototype name.  In this case, the name inside the
quotes is case sensitive.


Here's an example that might make the difference between these a bit more
clear.

     D JungleBoogie    PR                  extproc('QdnDanceInJungle')
     D   parm1                         *
     D   parm2                         *

If you coded %paddr(JungleBoogie) the procedure that it would call would
be 'QdnDanceInJungle'...  but if you coded %paddr('JungleBoogie') it would
not work, because the physical procedure isn't called JungleBoogie, it's
called QdnDanceInJungle....

What really happens with %paddr(JungleBoogie) is that the RPG compiler
looks at the JungleBoogie prototype, sees that the resulting procedure is
'QdnDanceInJungle' and so passes %paddr('QdnDanceInJungle') to the binder.

I'm sure there's a better way to explain this -- it's really very simple,
but I'm having a hard time explaining it.

Well, hopefully you understand.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.