An end marker must be present in every source unit that contains, is contained in, or precedes another source unit.
Program-name-1 must be identical to the program-name declared in a preceding Program-ID paragraph.
If a Program-ID paragraph declaring a specific program-name is stated between the Program-ID paragraph and the END PROGRAM marker for program-name-1, then an END PROGRAM marker referencing program-name must precede the END PROGRAM marker referencing program-name-1.
Function-prototype-name-1 must be identical to the function-prototype-name declared in the corresponding Function-ID paragraph.
User-function-name-1 must be identical to the user-function-name declared in the corresponding Function-ID paragraph.
Program-prototype-name-1 must be identical to the program-prototype-name declared in the corresponding Program-ID paragraph.
Class-name-1 must be identical to the class-name declared in the corresponding Class-ID paragraph.
Method-name-1 must be identical to the method-name declared in the corresponding Method-ID paragraph.
If the PROPERTY phrase is specified in the Method-ID paragraph, method-name-1 must be omitted.
Interface-name-1 must be identical to the interface-name declared in the corresponding Interface-ID paragraph.
If the source unit terminated by the end marker is contained within another source unit, the next statement must be either the first statement of a source unit or another end marker that terminates the containing source unit.
If the source unit terminated by an end marker is not contained within another source unit, the next statement must be the first statement of a compilation unit.
General Rules
An end marker indicates the end of the specified source unit.