The STOP statement halts execution of the object program either permanently or temporarily.
Statement - Format:
STOP RUN |
For Example, If STOP RUN coded in the sub program, the control will return to OS instead of returning to main program. In this case, the remaining task coded in main program will be incomplete.
Let see example below,
IDENTIFICATION DIVISION. PROGRAM-ID. MAINPROG. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 INPUT1 PIC 9(02). 01 INPUT2 PIC 9(02). 01 OUTPUT PIC 9(03). PROCEDURE DIVISION. ACCEPT INPUT1. ACCEPT INPUT2. COMPUTE OUTPUT = INPUT1 * INPUT2. DISPLAY OUTPUT. STOP RUN. |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!