RPGLE Procedure

295 pts.
Tags:
AS/400
RPGLE
In Procedure what is the use of Prototype? What does it denotes?
ASKED: November 10, 2007  2:39 PM
UPDATED: September 13, 2011  7:21 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

a prototype is the procedure interface definition

it describes the procedure so that it can be called from other procedures / programs

============================================================

A procedure prototype (definition type PR) has at least two general purposes, depending whether it’s in the called module or the calling module. Both purposes involve influencing the compiler.

In the module that contains the procedure, the prototype is compared against the procedure interface (definition type “PI”). The number, order and data types of the parameters, as well as any return value, are expected to match.

This is useful because the prototype is also needed in any module that uses the CALLP (Call with Prototype) op-code. By using /COPY for the prototype, you can ensure that the calling and called modules have the same prototype.

In the calling module with CALLP, the prototype is used by the compiler to help convert values from their variable data types to whatever types are needed by the called procedure. That’s why you don’t need to be nearly so concerned about using literals for parms or passing in integer values when the procedure expects packed. The possibility of mismatched parm definitions is drastically reduced.

In short, the prototype helps you write fewer C-specs that are less likely to have errors.

Tom

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following