View previous topic :: View next topic |
Author |
Message |
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Tue Jul 24, 2007 10:34 pm Post subject: help needed with this manual. |
|
|
This is a procedure division statement.
http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.jsp?topic=/com.ibm.entcobol4.doc/cppgm28.htm
I even have problem putting up my question.
1. Do you think there is a problem with the chart? what does paragraph name have anything to do with this statement?
2. If it's just equals to a continue statement, why does it say "The EXIT statement provides a common end point for a series of procedures." in the begining? what does it mean by providing an end point? what is an end point? It seems to be a basic concept, but I went through this reference it only appeared once in here.
Thank you everybody. |
|
Back to top |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
|
Back to top |
|
|
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Tue Jul 24, 2007 11:09 pm Post subject: Re: help needed with this manual. |
|
|
ds390 wrote: | 1. Do you think there is a problem with the chart? what does paragraph name have anything to do with this statement? | That is the general syntax, the EXIT is the first statement after the paragraph name.
Quote: | 2. If it's just equals to a continue statement, why does it say "The EXIT statement provides a common end point for a series of procedures." in the begining? what does it mean by providing an end point? what is an end point? | The EXIT is treated as an endpoint when the paragraph name is used as the terminating paragraph name in a PERFORM paragraph-name through EXIT-paragraph-name.
If a perform is not being executed, i.e., the logic if falling through, the EXIT has no effect and is treaed as a CONTINUE.
Does that help? |
|
Back to top |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Wed Jul 25, 2007 8:59 pm Post subject: |
|
|
CICS Guy,
I have just tested it to use a PERFORM paragraph-1 THROUGH paragraph-2 where paragraph 2 has a EXIT statement in the second line. like this:
PROGRAM-ID. T042.
PROCEDURE DIVISION.
PERFORM 100-TEST THROUGH 100-TEST-EXIT.
PERFORM 200-TEST.
STOP RUN.
100-TEST.
DISPLAY '100-TEST 1'.
DISPLAY '100-TEST 2'.
DISPLAY '100-TEST 3'.
100-TEST-EXIT.
DISPLAY '100-TEST 4'.
EXIT.
200-TEST.
DISPLAY '200-TEST 1'.
EXIT.
The result is:
100-TEST 1
100-TEST 2
100-TEST 3
100-TEST 4
200-TEST 1.
Which proved that EXIT doesn't have to be the first statement. In fact, I can delete the all the EXIT statements and the program still provide the same results. I even tried to put EXIT in front of DISPLAY '100-TEST 4' and it still provide the same result.
Can I put it this way, EXIT statement equals to a space? |
|
Back to top |
|
|
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Thu Jul 26, 2007 12:40 am Post subject: |
|
|
ds390 wrote: |
The result is:
100-TEST 1
100-TEST 2
100-TEST 3
100-TEST 4
200-TEST 1.
Can I put it this way, EXIT statement equals to a space? | No, your test was flawed, syntax requires the EXIT be the first statement after the paragaph name.
Try this version of your test, I would expect the result to be different.
PROGRAM-ID. T042.
PROCEDURE DIVISION.
PERFORM 100-TEST THROUGH 100-TEST-EXIT.
PERFORM 200-TEST.
100-TEST.
DISPLAY '100-TEST 1'.
DISPLAY '100-TEST 2'.
DISPLAY '100-TEST 3'.
100-TEST-EXIT.
EXIT.
DISPLAY '100-TEST 4'.
STOP RUN.
200-TEST.
EXIT.
DISPLAY '200-TEST 1'. |
|
Back to top |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Thu Jul 26, 2007 6:55 pm Post subject: |
|
|
the result is:
100-TEST 1
100-TEST 2
100-TEST 3
100-TEST 4 |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Jul 26, 2007 7:35 pm Post subject: |
|
|
ds390,
i don't see what all the fuss is about.
E-COBOL Lang Ref wrote: |
The EXIT statement is treated as a CONTINUE statement.
Any statements following the EXIT statement are executed
|
To have an EXIT statement simulate a return,
the EXIT statement must be followed by a Paragraph statement.
Any command statement - preceding the EXIT statement
- or
- after the EXIT statement
and the next Paragraph statement will be executed, as your results have so well displayed.
The THRU Paragraph is also performed. If there is only an EXIT statement between two paragraph statements and the first is the object of the THRU clause, then nothing is executed except a return.
The same holds true for PERFORM THRU's with Sections. You can not mix Paragraphs and Sections in a PERFORM THRU. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Thu Jul 26, 2007 10:33 pm Post subject: |
|
|
Thanks. everybody. I think what bothered me was that this EXIT statement works like a label/tag for PERFORM or GO TO, it's just documentary, but I thought it's really has a function by itself. BTW, if I remove the EXIT which immediately following the paragraph name, program just works the same. e.g.
I replace
100-TEST-EXIT.
EXIT.
by
100-TEST-EXIT.
It works fine too because the paragraph name is enough for the PERFORM and GO TO to direct the control flow. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri Jul 27, 2007 12:49 am Post subject: |
|
|
ds390,
try this: Code: |
PROGRAM-ID. T042.
PROCEDURE DIVISION.
DISPLAY 'PERFORMING THRU'.
PERFORM 100-TEST THROUGH 100-TEST-EXIT.
DISPLAY 'PERFORMING 200-TEST'.
PERFORM 200-TEST.
STOP RUN.
100-TEST.
DISPLAY '100-TEST 1'.
DISPLAY '100-TEST 2'.
DISPLAY '100-TEST 3'.
100-TEST-EXIT.
200-TEST.
DISPLAY '200-TEST 1'.
EXIT.
DISPLAY '200-TEST 2
|
_________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
ds390 Beginner
Joined: 23 Jan 2007 Posts: 82 Topics: 39
|
Posted: Fri Jul 27, 2007 10:41 pm Post subject: |
|
|
The result is:
PERFORMING THRU
100-TEST 1
100-TEST 2
100-TEST 3
PERFORMING 200-TEST
200-TEST 1
200-TEST 2 |
|
Back to top |
|
|
|
|