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

See Free-Form Parameter Definition.

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

  1. 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;
    
  2. 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 
    
  3. 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 
    
  4. 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 
    
  5. A prototype using DCL-PARM to define some of its subfields.
    1. 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.
    2. Parameter name does not have the same name as an operation code, so DCL-PARM is not required.
    3. 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;
    
  6. See Specifying *DCLCASE as the External Name for more examples.