%PADDR Used with a Prototype

The argument of %PADDR can be a prototype name, with the following restrictions:

Figure 237. %PADDR Example with a Prototype
 *----------------------------------------------------------------
 * Several prototypes
 *----------------------------------------------------------------
D proc1           PR
D proto2          PR                  EXTPROC('proc2')
D proc3           PR                  EXTPROC(procptr3)
D pgm1            PR                  EXTPGM('PGM3')
D meth            PR                  EXTPROC(*JAVA : 'myClass'
D                                           : 'meth1')

D procptr3        S               *

 *----------------------------------------------------------------
 * Valid examples of %PADDR with prototype names as the argument
 *----------------------------------------------------------------

 * constant1 is the same as %PADDR('PROC1') since 'PROC1' is the
 * procedure called by the prototype proc1
D constant1       C                   %PADDR(proc1)

 * constant2 is the same as %PADDR('proc2') since 'proc2' is the
 * procedure called by the prototype proto2
D constant2       C                   %PADDR(proto2)

 * %paddr(proc3) is the same as procedure pointer procptr3 since
 * procptr3 points to the procedure called by prototype proc3
C                   eval      procptr = %paddr(proc3)

 *----------------------------------------------------------------
 * Examples of %PADDR with prototype names as the argument
 * that are not valid
 *----------------------------------------------------------------
 * %PADDR(pgm1) is not valid because it is a prototype for a program
 * %PADDR(meth) is not valid because it is a prototype for a Java method
Figure 238. %PADDR with procedures whose prototype is implicitly defined from the procedure interface
 * constant1 is the same as %PADDR('myProc1').  Prototype
 * proc1 is implicitly defined from the procedure interface
 * of procedure proc1.  The external name 'myProc1' is 
 * defined by the EXTPROC keyword of the implicitly defined
 * prototype. 
D constant1       C                   %PADDR(proc1)

 * constant2 is the same as %PADDR('PROC2').  Prototype
 * proc2 has no prototype or procedure interface, so it has
 * a default prototype with the external name the same as
 * the internal procedure name. 
D constant2       C                   %PADDR(proc2)


P proc1           B
 * The prototype for proc1 is implicitly defined from the
 * procedure interface.  
 * - The name of the implicit prototype is proc1, the name 
 *   of the procedure
 * - The external procedure name is 'myProc1' taken from the
 *   EXTPROC keyword of the procedure interface 
D                 PI                  EXTPROC('myProc1')
 ...
P                 E

P proc2           B
 * No procedure interface is specified.
 * A default prototype is implicitly defined.
 * - The name of the implicit prototype is proc2, the name 
 *   of the procedure
 * - The external procedure name is 'PROC2' taken from the
 *   uppercased form of the name of the procedure.
...
P                 E

 



[ Top of Page | Previous Page | Next Page | Contents | Index ]