Main Procedure Considerations
You cannot define return values for a main procedure, nor can you specify that its parameters be passed by value.
The following considerations apply only to a cycle-main procedure:
- Because the cycle-main procedure is the only procedure with a complete set of specifications available (except the P specification), it should be used to set up the environment of all procedures in the module.
- A cycle-main procedure is always exported, which means that other procedures in the program can call the main procedure by using bound calls.
- The call interface of a cycle-main procedure can be
defined in one of two ways:
- Using a procedure interface and an optional prototype
- Using an *ENTRY PLIST without a prototype
- The functionality of an *ENTRY PLIST is similar to a prototyped call interface. However, a prototyped call interface is much more robust since it provides parameter checking at compile time. If you prototype the main procedure, then you specify how it is to be called by specifying either the EXTPROC or EXTPGM keyword on the prototype definition. If EXTPGM is specified, then an external program call is used; if EXTPROC is specified or if neither keyword is specified, it will be called by using a procedure call.