The EXIT command works the same regardless of how the QMF session was started: it marks all the user's sessions for termination.

When the EXIT command is entered on the command line, the session in which it is entered is terminated immediately. Each session begun by the INTERACT command terminates as the application that started it completes. When the EXIT command is issued in an application, the session ends when the original QMF session ends. All interactive sessions begun by the INTERACT command must end before QMF terminates.

In a callable interface program, it is important to include the QMF EXIT command when the application no longer needs QMF. If you forget to include this command, your QMF session remains active until you log off, or until your batch job completes.

When the user or an application issues the EXIT command, QMF sets DSQAO_TERMINATE to 1 (marked for termination). Only an application that runs within QMF can test and use this global variable. If DSQAO_TERMINATE is set to 1 when QMF returns to the main QMF session, QMF immediately terminates and releases resources.