Difference Between Similar Terms and Objects

Difference Between GOBACK and STOP RUN in COBOL

GOBACK vs STOP RUN in COBOL

STOP RUN and GOBACK are two commonly used terms in COBOL programming. GOBACK is a statement which refers to the logical end of a given program in COBOL. STOP RUN, on the other hand, will terminate the program on its own or if called by a COBOL program. Have you ever taken time to really think about what each of these two could be referring to and the differences between the similar functions that they perform? Well, these two indeed come with their differences, and it is these differences that this article addresses.

STOP RUN, as you would imagine, spells out just that. It infers that there is need to have a program in COBOL that was running to stop. It can therefore be said that STOP RUN terminates the specified run unit. Also, STOP RUN deletes all dynamically associated programs in the run unit. It is, however, important to note that STOP RUN does not delete the main program, only those that are link edited with it.

Although the STOP RUN statement does not have to be the last statement in a given sequence of COBOL programming, it ought to be realized that anything that follows STOP RUN will not be executed in COBOL. This means that STOP RUN closes all the files that have been defined in any associated programs.

GOBACK, on the other hand, is a statement that specifies the logical end of a specific program or even a method that has been invoked. Whenever the GOBACK statement is inserted in COBOL, it is important to have it at the tail end of all the statements that are inferred to. Any statements that appear after the execution of GOBACK will not be executed.

After the execution of the STOP RUN command, the inference is that COBOL should return you back to the Operating System (OS). To return to the main program, STOP RUN ought not to be used. Instead, the use of an Exit Program is preferred. GOBACK coding can work excellently when coded as a program or a subprogram. Upon it being entered, it takes control from the point at which it is entered.

The general syntax format that is employed by GOBACK includes the point where it appears in a consecutive sequence of imperative statements in a sentence. GOBACK must come as the last statement within a sequence. This is because any statements following the insertion of GOBACK are not executed.

In the event that a GOBACK statement is executed in a COBOL program that is being controlled by the runtime element, the runtime program will behave in a manner similar to it executing an EXIT statement. It is also important to note that it is not possible to use a STOP RUN as a sub program as is possible in GOBACK. STOP RUN is only possible to be executed in the main program. Whenever a GOBACK statement is executed within a function, the function will act as if it has been directed to execute an EXIT statement.

Summary

STOP RUN can only be used in the main program. When executed, it returns back to OS.
GOBACK can be used both in the main program and in a sub program.
GOBACK returns controls either back to the main program or to the OS.
Any statement following the GOBACK execution results in the subsequent statements not being executed.
Statements following STOP RUN are also not executed.
GOBACK in the sub program functions as an exit program.
GOBACK statement execution controlled by the runtime element.
A GOBACK statement is execution in a COBOL program that is controlled by a runtime element that makes the runtime program to behave in a manner similar to executing an EXIT.

Sharing is caring!


Search DifferenceBetween.net :




Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.


Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.


See more about : , , ,
Protected by Copyscape Plagiarism Finder