14 MAIN PROGRAM

A main program is a program unit that does not have a FUNCTION, SUBROUTINE, or BLOCK DATA statement as its first statement. It may have a PROGRAM statement as its first statement.

There must be exactly one main program in an executable program. Execution of an executable program begins with the execution of the first executable statement of the main program.

14.1 PROGRAM Statement

The form of a PROGRAM statement is:
PROGRAM pgm
where pgm is the symbolic name of the main program in which the PROGRAM statement appears.

A PROGRAM statement is not required to appear in an executable program. If it does appear, it must be the first statement of the main program.

The symbolic name pgm is global ( 18.1.1) to the executable program and must not be the same as the name of an external procedure, block data subprogram, or common block in the same executable program. The name pgm must not be the same as any local name in the main program.

14.2 Main Program Restrictions

The PROGRAM statement may appear only as the first statement of a main program. A main program may contain any other statement except a BLOCK DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN statement. The appearance of a SAVE statement in a main program has no effect.

A main program may not be referenced from a subprogram or from itself.

'bp '


[Contents] [Previous] [Next] [Home]

 

NDP77
http://www.ndp77.net
webmaster MFA (main)
webmaster@ndp77.net