Application termination

The copybook, lixmltrm.cpy, provides an orderly way to shut down an application. This copybook contains the following text:
Display "Status: " XML-Status.
Perform Display-Status.
Perform Display-Status.

The first line may be modified or removed, as you choose. The first PERFORM statement displays any pending status messages (from a previous XML statement). The XML TERMINATE statement shuts down XML Extensions. The second PERFORM statement displays any status from the XML TERMINATE statement.

The following logic is sufficient to successfully terminate XML Extensions:
Copy "lixmltrm.cpy". 
Stop Run. 
Copy "lixmldsp.cpy".

The Z. paragraph-name is where the exit logic begins. The flow of execution may reach here by falling through from the previous paragraph or as the result of a program branch. The STOP RUN statement is used to prevent the application from falling through to the Display-Status paragraph. An EXIT PROGRAM or GOBACK statement also may be used, if appropriate.