Free-Form Prototype Definition
A prototype begins with a DCL-PR statement.
The DCL-PR statement is followed by zero or more parameters, followed by an END-PR statement.
DCL-PR statement to begin the prototype
The first statement begins with DCL-PR, followed by the name of the prototype, followed by keywords, and finally a semicolon.
Prototype parameters
END-PR statement to end the prototype
- END-PR may be followed by the name of the prototype.
- If there are no parameters, END-PR may be specified as part of the DCL-PR statement, following the keywords and before the semicolon. In this case, END-PR cannot be followed by the name of the prototype.
Examples of free-form prototypes
- A prototype for a program with one parameter.
The external name of the program is 'MYPGM'.
DCL-PR myPgm EXTPGM; 1 name CHAR(10) CONST; END-PR;
- A prototype addNewOrder
with three parameters.
The END-PR statement is specified without a name.
DCL-PR addNewOrder; id INT(10) CONST; quantity INT(10) CONST; price PACKED(7 : 2) CONST; END-PR; 2
- A name is specified for the END-PR statement
DCL-PR addNewOrder; id INT(10) CONST; quantity INT(10) CONST; price PACKED(7 : 2) CONST; END-PR addNewOrder; 3
- The prototype has no parameters,
so the END-PR is specified as part of the DCL-PR statement.
DCL-PR getCurrentUser CHAR(10) END-PR; 4
- A prototype using DCL-PARM to define
some of its subfields.
- Parameter select has the same name as an operation code allowed in free-form calculations. DCL-PARM is required for this parameter. See Table 1.
- Parameter name does not have the same name as an operation code, so DCL-PARM is not required.
- Parameter address does not have the same name as an operation code, so DCL-PARM is not required, but it is valid.
DCL-PR myProc; DCL-PARM select CHAR(10); 5a name CHAR(10); 5b DCL-PARM address CHAR(25); 5c END-PR;
- See Specifying *DCLCASE as the External Name for more examples.