STOP RUN in COBOL sub program execution result

There is a discussion in many forums that if we give ‘STOP RUN’ in COBOL sub-module what will happen.

The definition from IBM – A STOP RUN statement returns control to the caller of the program at the nearest control boundary. If this is a hard control boundary, the activation group (run unit) will end, and all files scoped to the activation group will be closed.

The answer to this question is as follows.

This is a good question for COBOL developers. The simple answer is your program execution will be stopped.

Sub program cannot send control back to main module. So your execution will be stopped when you give STOP RUN.

Whereas the GOBACK and EXIT-PROGRAM are only pass control back to called module.

GOBACK has dual capability it can be given in both main and sub modules.


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.