Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 6: Procedure Division


STOP RUN

  • STOP RUN is the last executable statement of the main program and it transfers control back to OS
  • STOP RUN should be coded only in main (calling) program. However, when coded in sub-program (called program), the control will directly be returned to OS instead of returning to main program. This may cause remaining statement of main program to be skipped.
  • STOP RUN closes all the opened files of program.
  • Syntax:-

    STOP RUN.

  • Example:-
    Main program code snippet:-
    PROCEDURE DIVION. DISPLAY ‘HELLO WORLD.’ CALL SUB-PROG. STOP RUN.
    Sub-program “SUB-PROG” code snippet:-
    LINKAGE SECTION. . . PROCEDURE DIVION. DISPLAY ‘SUB-PROGRAM IS CALLED’ GOBACK.
  • For complete program, please refer module ‘LINKAGE SECTION’< LINK >






© copyright mainframebug.com
Privacy Policy