The EXIT statement provides a common end point for a series of procedures.The EXIT PROGRAM statement marks the logical end of a called program.The EXIT PERFORM statement provides a means of exiting an in-line PERFORM (with or without returning to any specified test).The EXIT PARAGRAPH or EXIT SECTION statements provide a means of exiting a structured procedure without executing any of the following statements within a procedure.
Format 1:Exit Paragraph
Format 2:Exit Program
Format 3:Exit In-Line Perform
EXIT PERFORM [ CYCLE ]
Format 4:Exit Paragraph or Section
The Format 1 EXIT statement must appear in a sentence by itself, and that sentence must be the only sentence in the paragraph.
If a Format 2, Format 3, or Format 4 EXIT statement appears in a consecutive sequence of imperative statements within a sentence, it must appear as the last statement in that sequence.
The Format 2 EXIT PROGRAM statement must not appear in a declarative procedure in which the GLOBAL phrase is specified.
The Format 1 EXIT statement allows the user to assign a procedure-name to a given point in a program.Such an EXIT statement has no other effect on the compilation or execution of the program.The Format 1 EXIT statement, together with its paragraph- name, is equivalent to an empty paragraph.
If the Format 2 EXIT PROGRAM statement is executed in a program that is not under the control of a calling program, the EXIT PROGRAM statement causes execution of the program to continue with the next executable statement.
The execution of a Format 2 EXIT PROGRAM statement in a called program, which does not possess the initial attribute, causes execution to continue with the next executable statement following the CALL statement in the calling program.The program state of the calling program is not altered and is identical to that which existed at the time it executed the CALL statement except that the contents o f data items and the contents of data files shared between the calling and called program may have been changed. The program state of the called program is not altered except that the ends of the ranges of all PERFORM statements executed by that called program are considered to have been reached.
Besides the actions specified in the preceding paragraph, the execution of an EXIT PROGRAM statement in a called program, which possesses the initial attribute, is equivalent also to executing a CANCEL statement referencing that program.
The Format 3 EXIT PERFORM statement may be specified only in an in-line PERFORM statement.
The execution of a Format 3 EXIT PERFORM statement without the CYCLE phrase causes control to be passed to an implicit CONTINUE statement immediately following the END-PERFORM phrase that matches the most closely preceding, and as yet unterminated, in-line PERFORM statement.
The execution of a Format 3 EXIT PERFORM statement with the CYCLE phrase causes control to be passed to an implicit CONTINUE statement immediately preceding the END-PERFORM phrase that matches the most closely preceding, and as yet unterminated, in-line PERFORM statement.
The Format 4 EXIT statement with the PARAGRAPH phrase may be specified only in a paragraph.
The execution of a Format 4 EXIT statement with the PARAGRAPH phrase causes control to be passed to an implicit CONTINUE statement immediately following the last statement in the current paragraph.
The Format 4 EXIT statement with the SECTION phrase may be specified only in a section.
The execution of a Format 4 EXIT statement with the SECTION phrase causes control to be passed to an implicit CONTINUE statement within an implicit paragraph immediately following the last statement in the current section.
Exit Statement Examples
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.