/EOF

The /EOF compiler directive is used to indicate that the compiler should consider that end-of-file has been reached for the current source file.

See Compiler Directives for information on the columns available for directives.

The remainder of the line containing /EOF must be blank.

/EOF will end any active /IF group that became active during the reading of the current source member. If the /EOF was in a /COPY file, then any conditions that that were active when the /COPY directive was read will still be active.
Note: If excluded lines are being printed on the listing, the source lines will continue to be read and listed after /EOF, but the content of the lines will be completely ignored by the compiler. No diagnostic messages will ever be issued after /EOF.
Tip:

Using the /EOF directive will enhance compile-time performance when an entire /COPY member is to be used only once, but may be copied in multiple times. (This is not true if excluded lines are being printed).

The following is an example of the /EOF directive.

Figure 1. /EOF Directive
      *-----------------------------------------------------------------
      * Main source file
      *-----------------------------------------------------------------
      ....
      /IF DEFINED(READ_XYZ)                        1 
      /COPY XYZ
      /ENDIF                                       2 
      ....
      *-----------------------------------------------------------------
      * /COPY file XYZ
      *-----------------------------------------------------------------
      /IF DEFINED(XYZ_COPIED)                      3 
      /EOF
      /ELSE
      /DEFINE XYZ_COPIED
       D .....
      /ENDIF

The first time this /COPY member is read, XYZ_COPIED will not be defined, so the /EOF will not be considered.

The second time this member is read, XYZ_COPIED is defined, so the /EOF is processed. The /IF DEFINED(XYZ_COPIED) ( 3 ) is considered ended, and the file is closed. However, the /IF DEFINED(READ_XYZ) ( 1 ) from the main source member is still active until its own /ENDIF ( 2 ) is reached.