COBOL Ideas What Happens When You Give Stop RUN in Submodule

There is a discussion in many forums that if we give ‘STOP RUN’ in the 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 Tricky question for COBOL developers. The right answer is it will stop executing the program.

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

Whereas the GOBACK and EXIT-PROGRAM are only passed control back to the calling program.

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

Related Posts

Author: Srini

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