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


  • Subject: Re: CALL, CALLP, & CALLB
  • From: boldt@xxxxxxxxxx
  • Date: Fri, 26 Feb 1999 13:30:41 -0500



Patrick wrote:
>I am trying to distinguish the differences in the CALLP & CALLB commands
>vs. the CALL command in RPG IV. I am trying to locate a web site or
>document that summarizes the differences between these and to give me some
>ideas as when to use these.
>
>We use a LOT of CALLs to subprograms (verifying account numbers, returning
>employee information, returning item file information). I assume that both
>CALLP and CALLB will be faster than a CALL. Does anyone have any hints as
>to best convert the subprogram to a module, and what prototypes should be
>used for this?
>
>And if you know of a good website with code examples that are easy to
>follow, please let me know.

Have you read the RPG IV Reference Manual and the RPG IV Programmers
Guide?

First, CALLB is faster than CALL since it is calling something thats
statically bound.

CALLP is a replacement for both CALL and CALLB in that it can do both
static and dynamic calls.  When you use CALLP, you must code a procedure
prototype in your D-Specs.  On the prototype, you can define either
bound or dynamic call linkage.  Keyword EXTPROC is used to specify bound
linkage and EXTPGM is used for dynamic linkage.  (The default is bound
linkage.)

The main difference is that CALLP provides better error checking on the
parameter types than CALL/CALLB.  It also provides additional function
such as value and constant reference parameters.

Programs that you call currently using CALL or CALLB can easily be
called using CALLP by defining a prototype for that program.  Just look
at the types of the fields defined in the *ENTRY PLIST for the program
and define the parameters in the prototype to match.  Note that type
checking on a CALLP is much more rigorous than on a CALL, so you have
to be careful defining the parameters.  For example, if you want to be
able to pass character fields of different lengths or arrays with
different numbers of elements, you need to specify OPTIONS(*VARSIZE).
If certain parameters are optional, you need to specify OPTIONS(*OMIT)
or OPTIONS(*NOPASS).

You don't have to change anything in the called program to be able to
call it using CALLP.  If you want to take advantage of new language
features, though, you could define a procedure interface for that
program to replace the *ENTRY PLIST.  When adding new functionality,
you could code that using sub-procedures.

When defining the prototypes for a module, the approach we recommend is
to place the prototypes for a module in a /COPY member.  Include that
/COPY member in the modules source as well as the source files of all
other modules that call procedures in that module.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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 thread ...

Follow-Ups:

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.