A main program is the program unit that receives control from the system when the executable program is invoked at run time.
>>-+-------------------+--------------------------------------->< '-PROGRAM_statement-' >>-+--------------------+-------------------------------------->< '-specification_part-' >>-+----------------+------------------------------------------>< '-execution_part-' >>-+--------------------------+-------------------------------->< '-internal_subprogram_part-' >>-END_PROGRAM_statement--------------------------------------->< |
A main program cannot contain an ENTRY statement, nor can it specify an automatic object.
+-------------------------------IBM Extension--------------------------------+
A RETURN statement can appear in a main program. The execution of a RETURN statement has the same effect as the execution of an END statement.
+----------------------------End of IBM Extension----------------------------+
A main program cannot reference itself, directly or indirectly.