Previous Topic Next topic Print topic


MF 

Call Prototypes

A call prototype is a program declaration or skeleton program which serves to define the characteristics of a called subprogram. These characteristics include the number of parameters required, the type of these parameters and the calling convention. If a source element contains a CALL statement referring to a subprogram for which a prototype exists, the CALL statement is checked against the prototype. If there is an explicit mismatch, an error is given. If the CALL statement leaves some characteristics (such as the call convention) undefined, this is derived from the prototype.

The call prototype is defined as a complete program in which the EXTERNAL clause is specified in the Program-ID paragraph. The program structure should consist only of an Identification Division with a Program-ID paragraph, a Data Division with a Linkage Section, a PROCEDURE DIVISION header, and optional ENTRY statements. These call prototypes are placed before the other types of compilation units in a similar way to multi-program source files.

Note that you must include a copy of the call prototype for every subprogram to which you want your CALL statements checked before the IDENTIFICATION DIVISION header of your compilation unit containing the CALL statements.

Previous Topic Next topic Print topic