In the attached program, a GO TO to a paragraph containing only EXIT just continues. The EXIT is not executed. The paragraph is not referenced by a PERFORM THRU. Just GO TO 135-CCVS1-EXIT. The program continues with the code following the exit.
Back in the 60's when I taught COBOL, you would perform a paragraph thru a paragraph containing only EXIT and the EXIT returned you back to the perform to continue from that point. This has been true for all of my experiences for more than 50 years. I do not understand why this program does not bomb when it goes to the exit paragraph. The program runs correctly and produces a small report file XXXXX055.
The program is BEAUTIFUL.COB and it calls the dll IC102A.COB in case you want to compile them to test.
In the attached program, a GO TO to a paragraph containing only EXIT
just continues. The EXIT is not executed. The paragraph is not
referenced by a PERFORM THRU. Just GO TO 135-CCVS1-EXIT. The program
continues with the code following the exit.
Back in the 60's when I taught COBOL, you would perform a paragraph
thru a paragraph containing only EXIT and the EXIT returned you back
to the perform to continue from that point. This has been true for all
of my experiences for more than 50 years. I do not understand why this
program does not bomb when it goes to the exit paragraph. The program
runs correctly and produces a small report file XXXXX055.
The process for an EXIT verb is exactly the same as it has always been :
perform para-a thru para-exit.
This will exit after the EXIT verb in para-E.
perform Para-A - this will return after last statement in para-a
go to para-a will process para-a then go to para-exit where as the
exit is not set will be ignored.
A bad bit of code would be to do perform para-a thru para-e and in
para-a there is a go to outside both paragraphs.
When next para-a is processed as a go to the exit code could be
processed depending on the compiler used, i.e., the exit setting has not
been reset.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2022-10-29
In every IBM mainframe COBOL compiler I ever used, the EXIT statement was a NO-OP. You could put an EXIT as the first verb in a paragraph, or the last verb in a paragraph, and it would behave exactly like a CONTINUE statement.
Unless the exit paragraph is referenced by a PERFORM THRU, the EXIT verb in that paragraph has nothing to do.
I believe the compiler is working correctly.
Kind regards,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, that explains it.
I always thought the exit itself generated a restore of registers and a branch back.
One is never too old to learn.
Thanks
Michael :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since COBOL-85 and scope terminators, Perform Thru's Exit and GoTo's are not needed. The real reason for the Exits was to 'bail out' of a paragraph. Using structured programming via 'periodless programming', there is no need to use either anymore, and even the sneaky 'GoTo', the Continue statement.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In the attached program, a GO TO to a paragraph containing only EXIT just continues. The EXIT is not executed. The paragraph is not referenced by a PERFORM THRU. Just GO TO 135-CCVS1-EXIT. The program continues with the code following the exit.
Back in the 60's when I taught COBOL, you would perform a paragraph thru a paragraph containing only EXIT and the EXIT returned you back to the perform to continue from that point. This has been true for all of my experiences for more than 50 years. I do not understand why this program does not bomb when it goes to the exit paragraph. The program runs correctly and produces a small report file XXXXX055.
The program is BEAUTIFUL.COB and it calls the dll IC102A.COB in case you want to compile them to test.
Michael :-)
On 29/10/2022 03:06, Michael F Gleason wrote:
The process for an EXIT verb is exactly the same as it has always been :
perform para-a thru para-exit.
This will exit after the EXIT verb in para-E.
perform Para-A - this will return after last statement in para-a
go to para-a will process para-a then go to para-exit where as the
exit is not set will be ignored.
A bad bit of code would be to do perform para-a thru para-e and in
para-a there is a go to outside both paragraphs.
When next para-a is processed as a go to the exit code could be
processed depending on the compiler used, i.e., the exit setting has not
been reset.
Para-A.
code . . . and fall through
Para-Exit. EXIT.
In every IBM mainframe COBOL compiler I ever used, the EXIT statement was a NO-OP. You could put an EXIT as the first verb in a paragraph, or the last verb in a paragraph, and it would behave exactly like a CONTINUE statement.
Unless the exit paragraph is referenced by a PERFORM THRU, the EXIT verb in that paragraph has nothing to do.
I believe the compiler is working correctly.
Kind regards,
Well, that explains it.
I always thought the exit itself generated a restore of registers and a branch back.
One is never too old to learn.
Thanks
Michael :-)
Since COBOL-85 and scope terminators, Perform Thru's Exit and GoTo's are not needed. The real reason for the Exits was to 'bail out' of a paragraph. Using structured programming via 'periodless programming', there is no need to use either anymore, and even the sneaky 'GoTo', the Continue statement.