To answer this question, we need to understand the purpose of the STOP RUN
statement and the GO BACK
statement in COBOL.
The STOP RUN
statement is used to terminate the execution of a COBOL program. It stops the program and releases any resources used by the program. This statement is typically placed at the end of the program.
The GO BACK
statement is used to transfer control back to the calling program or system. It is typically used in a program that is called by another program or system.
Now, let's go through each option to understand why it is correct or incorrect:
Option A) Nothing, the program will behave normally.
This option is incorrect because the GO BACK
statement is not designed to terminate the program. Instead, it transfers control back to the calling program or system. Without a STOP RUN
statement, the program will not terminate properly.
Option B) The program will go in an infinite loop.
This option is correct. If you use the GO BACK
statement instead of the STOP RUN
statement in a standalone COBOL program, the program will not terminate and will enter an infinite loop. This is because the program will keep going back to the calling program or system without a proper termination statement.
Option C) The program will not get compiled.
This option is incorrect. The presence of the GO BACK
statement instead of the STOP RUN
statement does not affect the compilation of the COBOL program. The program will still compile successfully.
Option D) Output files won't be generated.
This option is incorrect. The presence of the GO BACK
statement instead of the STOP RUN
statement does not affect the generation of output files in a COBOL program. The program will still generate output files if the necessary file handling statements are included.
Therefore, the correct answer is B) The program will go in an infinite loop. This option is correct because the GO BACK
statement does not terminate the program, leading to an infinite loop.