Supported RPG Features

The REQPREXP keyword on CTL-OPT (or H-spec) controls whether exported procedures must have a corresponding prototype declaration (DCL-PR).

Value Meaning
REQPREXP(*NO) Prototypes not required for exported procedures (default)
REQPREXP(*REQUIRE) Compilation fails if an exported procedure has no prototype

Non-exported (internal) procedures are not affected by this keyword. The cycle-main procedure is: a program whose main procedure interface has no matching prototype is reported under REQPREXP(*REQUIRE) just as an exported procedure would be.

**FREE
CTL-OPT NOMAIN REQPREXP(*REQUIRE);

// This prototype is required because REQPREXP(*REQUIRE) is active
DCL-PR AddNums INT(10);
  pA INT(10) CONST;
  pB INT(10) CONST;
END-PR;

DCL-PROC AddNums EXPORT;
  DCL-PI *N INT(10);
    pA INT(10) CONST;
    pB INT(10) CONST;
  END-PI;
  RETURN pA + pB;
END-PROC;

REQPROTO(*NO) - Exempting One Procedure

REQPROTO(*NO) states that a prototype is never required for one particular procedure, exempting it from REQPREXP(*REQUIRE). Everything else in the module still obeys the requirement.

*NO is the only value it takes, and the parameter is not optional.

It is valid in exactly three places:

It is not valid on a subprocedure's own DCL-PI, on the DCL-PI of a linear-main procedure (the one named by MAIN()), or on a DCL-PR prototype. Those are reported as TRN2148.

**FREE
CTL-OPT NOMAIN REQPREXP(*REQUIRE);

// Exempt: no prototype needed despite REQPREXP(*REQUIRE).
DCL-PROC Helper EXPORT REQPROTO(*NO);
  DCL-PI *N INT(10);
    pA INT(10) CONST;
  END-PI;
  RETURN pA;
END-PROC;
      * The same exemption in fixed format, in the P-spec keyword area.
     P Helper          B                   EXPORT REQPROTO(*NO)
     D Helper          PI            10I 0
     D   pA                          10I 0 CONST
     C                   RETURN    pA
     P Helper          E