COBOL subroutine why “EXIT PROGRAM” is mandatory

In COBOL program there are three key phrases. Those are STOP RUN, GOBACK and EXIT PROGRAM. The phrase EXIT PROGRAM can use in subroutine.

What happens if it has given:

This statement “EXIT PROGRAM” gives control back to calling module. So, calling module continue processing still STOP RUN or GOBACK.

What happens if it has not given:

If EXIT PROGRAM not be given, the calling module does not get control back. So, an unpredictable abend/exception occurs in calling module.

This is an interview question often asked in COBOL interviews.

Advertisements

Author: Srini

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