Introduction - COBOL STOP RUN Statement.
COBOL STOP RUN Statement - Syntax.
The syntax of the COBOL STOP RUN verb is as follows:
STOP RUN
COBOL STOP RUN Verb - Example.
In the following example, the COBOL STOP RUN verb is used at the end of the core business logic within the procedure division. When the STOP RUN statement in COBOL is executed, the processing of the program is terminated.000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. DEMOCL04.
000300 AUTHOR. TOPICTRICK.
000400 DATE-WRITTEN. 01-JAN-2023.
000500 DATE-COMPILED. 01-APR-2023.
....
....
....
016800 PROCEDURE DIVISION.
016900 0000-CORE-BUSINESS-LOGIC.
017000 PERFORM A000-INIT-VALS
017100 PERFORM B000-OPEN-FILE
017200 PERFORM C000-PRNT-HDRS
017300 PERFORM D000-PROC-RECD
017400 PERFORM X000-CLSE-FILE
017500 STOP RUN.
COBOL STOP RUN VS COBOL GOBACK Statement - Difference.
- The STOP RUN statement in COBOL is used to terminate the execution of a program and return control to the operating system. It is typically used at the end of a program to signal that the program has completed its processing and that resources, such as memory, should be freed. When the STOP RUN statement is executed, the COBOL runtime system performs a series of clean-up tasks, such as closing any open files, releasing allocated memory, and returning control to the operating system.
- The GOBACK statement in COBOL is used to return control to the calling program or to the operating system. It is typically used to return from a called program or a subroutine. When the GOBACK statement in COBOL is executed, the COBOL runtime system performs a similar clean-up tasks as the STOP RUN statement, such as closing any open files, releasing allocated memory, and returning control to the calling program or to the operating system.
Conclusion.
Do check out COBOL LEVEL 88 Condition.
No comments:
Post a Comment