Sunday 22 September 2013

COBOL Ending and Reentering.


COBOL is one of the robust language, which include lot of prominent feature. COBOL provide three different termination statement that can be used terminate processing of application program. Refer below figure and table for more details.
Termination StatementMainprogram Subprogram




EXIT PROGRAM




No action taken
Return to calling program without ending the run unit.
An implicit EXIT PROGRAM statement is generated if the called program has no next executable statement.
In a threaded environment, the thread is not terminated unless the program is the first (oldest) one in the thread.








STOP RUN
Return to calling program.1 (Might be the operating system, and application will end.)

STOP RUN terminates the run unit, and deletes all dynamically called programs in the run unit and all programs link-edited with them. (It does not delete the main program.)

In a threaded environment, the entire Language Environment enclave is terminated, including all threads running within the enclave.
Return directly to the program that called the main program.
1 (Might be the operating system, and application will end.)

STOP RUN terminates the run unit, and deletes all dynamically called programs in the run unit and all programs link-edited with them. (It does not delete the main program.)

In a threaded environment, the entire Language Environment enclave is terminated, including all threads running within the enclave.



GOBACK
Return to calling program.

1 (Might be the operating system, and application will end.)

GOBACK terminates the run unit, and deletes all dynamically called programs in the run unit and all programs link-edited with them. (It does not delete the main program.)

In a threaded environment, the thread is terminated.2





Return to calling program. In a threaded environment, if the program is the first program in a thread, the thread is terminated.2

  1. If the main program is called by a program written in another language that does not follow Language Environment linkage conventions, return is to this calling program.
  2. If the thread is the initial thread of execution in an enclave, the enclave is terminated.



Created with Artisteer

No comments:

Post a Comment

New In-feed ads