PROCEDURE SPECIFICATION


The procedure specification is used to isolate the first and last statement of an RPG subprocedure. The procedure specification simply blocks the starting and ending source statements of the subprocedure and, optionally, identifies the procedure as being available to other procedures. The procedure specification ruler is shown in Figure 2.18.

start figure

 .....PProcName+++++++..B...................Functions++++++++++++++++++++++++++++ 

end figure

Figure 2.18: Procedure specification ruler.

Procedure Definition

A procedure definition is made up of three parts:

  • Procedure prototype (specified with the definition specification).

  • Procedure identification (specified with the procedure specification).

  • Procedure interface (specified with the definition specification).

With only two exceptions, the procedure prototype and the procedure interface are similar interfaces. First, the type of definition specification is PR (for the procedure prototype) and PI (for the procedure interface). Second, the parameter names specified on the procedure interface are accessible by the procedure. The names specified on the procedure prototype, however, are optional and are used for documentation purposes only. They are not accessible by the calling procedure.

A procedure prototype is required within any program that calls the subprocedure and by the subprocedure itself. Procedure prototypes can be stored in a separate source file, and are included at compile time through the /COPY compiler directive. This allows the prototype to be inserted into any source file that requires it.

Procedure Specification Summary

Table 2.21 summarizes the procedure specification.

Table 2.21: Procedure Specification Summary

Column

Title

Values

Description

6

Form type

P

Identifies this statement as a procedure specification.

7 – 21

Procedure name

Name

Name of the procedure being defined.

24

B

This procedure specification identifies the beginning of the subprocedure named in positions 7 to 21.

E

This procedure specification identifies the ending of the subprocedure named in positions 7 to 21.

44 – 80

Functions

Keywords

Any valid procedure specification keyword can be specified. Currently, the EXPORT keyword is the only procedure keyword.

Procedure Specification Keyword Summary

Table 2.22 summarizes the keyword for the procedure specification.

Table 2.22: Procedure Specification Keyword Summary

Keyword

Parameters

Description

EXPORT

['Exported procedure name']

The procedure is exported and made available to other "external" modules. The exported procedure name is optional and, if specified, indicates the name of the procedure as it is exported. This exported name is the name used by other modules to import this procedure. Exported names specified on this keyword are enclosed in quotes and are exported case sensitive.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net