EXIT SECTION/PARAGRAPH - cobol

This is a discussion on EXIT SECTION/PARAGRAPH - cobol ; Does the per subject terminate current execution of this module (possibly the runtime executable) when a) No section is there , (with EXIT PARAGRAPH) b) SECTION is there but no paragraph. Roger...

+ Reply to Thread
Page 1 of 6 1 2 3 ... LastLast
Results 1 to 10 of 51

EXIT SECTION/PARAGRAPH

  1. Default EXIT SECTION/PARAGRAPH

    Does the per subject terminate current execution
    of this module (possibly the runtime executable)
    when
    a) No section is there , (with EXIT PARAGRAPH)
    b) SECTION is there but no paragraph.

    Roger



  2. Default Re: EXIT SECTION/PARAGRAPH


    "Roger While" <simrw@sim-basis.de> wrote in message
    news:fbrnco$hhi$03$1@news.t-online.com...
    > Does the per subject terminate current execution
    > of this module (possibly the runtime executable)
    > when
    > a) No section is there , (with EXIT PARAGRAPH)
    > b) SECTION is there but no paragraph.


    EXIT SECTION without a section is a syntax error,
    as required by 2002, EXIT statement SR(11).

    EXIT PARAGRAPH in an unnamed paragraph
    transfers control to the end of the paragraph, as
    required by 2002, EXIT statement GR(11).

    Note that, if declaratives are used and there is only
    one section for the body of the procedure division,
    EXIT SECTION will transfer control to the end of
    that section as required by 2002, EXIT statement
    GR(12). This will, in effect, transfer control to the
    explicit GOBACK statement that occurs at the end
    of the source element, as described in 2002, 14.5.3,
    last paragraph.




  3. Default Re: EXIT SECTION/PARAGRAPH


    "Rick Smith" <ricksmith@mfi.net> wrote in message
    news:13e312ci1s7ur41@corp.supernews.com...
    [snip]
    > This will, in effect, transfer control to the
    > explicit GOBACK statement [...]


    I should have written "... implicit GOBACK satement ...".




  4. Default Re: EXIT SECTION/PARAGRAPH

    On Fri, 7 Sep 2007 16:31:51 +0200, "Roger While" <simrw@sim-basis.de> wrote:

    >Does the per subject terminate current execution
    >of this module (possibly the runtime executable)
    >when
    >a) No section is there , (with EXIT PARAGRAPH)
    >b) SECTION is there but no paragraph.


    EXIT PERFORM from code that's not under a paragraph header will give a compiler error like
    "must appear within a paragraph".

    EXIT SECTION from code that's not under a section header will give a compiler error like
    "must appear within a section".

    If they pass those tests, they go to the end of the paragraph or section, same as if your
    code fell to the end. If that means falling off the end of the procedure division, most
    compilers generate a GOBACK there, some throw an exception.

  5. Default Re: EXIT SECTION/PARAGRAPH

    On Fri, 7 Sep 2007 12:59:30 -0400, "Rick Smith" <ricksmith@mfi.net> wrote:

    >Note that, if declaratives are used and there is only
    >one section for the body of the procedure division,
    >EXIT SECTION will transfer control to the end of
    >that section as required by 2002, EXIT statement
    >GR(12). This will, in effect, transfer control to the
    >explicit GOBACK statement that occurs at the end
    >of the source element, as described in 2002, 14.5.3,
    >last paragraph.


    Old School Cobol programmers have an almost genetic belief that the last line of a program
    must be its exit. I've seen this structure thousands of times:

    procedure division.
    main-line. *> non-functional paragraph name
    perform beginning-of-program
    perform middle-of-program
    perform end-of-program.
    .....
    end-of-program.
    goback.
    * --- last line in source code ---

    Why don't they say GO TO end-of-program, or just say goback in main-line?

    Why don't they understand that temporal cohesion is a poor way to structure a program?
    Cohesion is supposed to be functional.

    Now that goback at the end is in the Standard, their instictive belief has been
    vindicated. They'll cite it as proof they were Right all along.

  6. Default Re: EXIT SECTION/PARAGRAPH

    Interesting. I have NEVER seen that structure. I almost always see either a
    "perform 999-End-Of-Program" - that never comes back - but includes closes and
    GOBACK, etc.
    Or I see the GOBACK at the end of the mainline.

    FYI,
    You might want to look at the section "5.1.1.8 Implicit EXIT PROGRAM" in the
    COBOL Migration Guide at:
    http://publibz.boulder.ibm.com/cgi-b...y3mg32/5.1.1.8

    The "user expecting an ABEND if you "fall off" the end of the source code" is
    the problem that I have heard of with OLD IBM mainframe code.
    --
    Bill Klein
    wmklein <at> ix.netcom.com
    "Robert" <no@e.mail> wrote in message
    news:gq54e3tujvakviekt9uklks3hv2vlracur@4ax.com...
    > On Fri, 7 Sep 2007 12:59:30 -0400, "Rick Smith" <ricksmith@mfi.net> wrote:
    >
    >>Note that, if declaratives are used and there is only
    >>one section for the body of the procedure division,
    >>EXIT SECTION will transfer control to the end of
    >>that section as required by 2002, EXIT statement
    >>GR(12). This will, in effect, transfer control to the
    >>explicit GOBACK statement that occurs at the end
    >>of the source element, as described in 2002, 14.5.3,
    >>last paragraph.

    >
    > Old School Cobol programmers have an almost genetic belief that the last line
    > of a program
    > must be its exit. I've seen this structure thousands of times:
    >
    > procedure division.
    > main-line. *> non-functional paragraph name
    > perform beginning-of-program
    > perform middle-of-program
    > perform end-of-program.
    > ....
    > end-of-program.
    > goback.
    > * --- last line in source code ---
    >
    > Why don't they say GO TO end-of-program, or just say goback in main-line?
    >
    > Why don't they understand that temporal cohesion is a poor way to structure a
    > program?
    > Cohesion is supposed to be functional.
    >
    > Now that goback at the end is in the Standard, their instictive belief has
    > been
    > vindicated. They'll cite it as proof they were Right all along.




  7. Default Re: EXIT SECTION/PARAGRAPH

    On Sat, 08 Sep 2007 07:10:31 GMT, "William M. Klein" <wmklein@nospam.netcom.com> wrote:

    >Interesting. I have NEVER seen that structure. I almost always see either a
    >"perform 999-End-Of-Program" - that never comes back - but includes closes and
    >GOBACK, etc.


    Same as my example. I omitted closes to illustrate the point.

    >Or I see the GOBACK at the end of the mainline.


    That's where it belongs. Entry was at main-line, so exit should be at the same level.

    The fundamental problem is PERFORM, a degraded form of CALL. If paragraphs had been
    CALLed, they would have received as much respect as programs. Moreover, we could have
    passed parameters to them. Instead of being forced to write:

    move x to foo-input
    perform foo
    move foo-output to y

    We should have written

    call foo using x, y

    >FYI,
    > You might want to look at the section "5.1.1.8 Implicit EXIT PROGRAM" in the
    >COBOL Migration Guide at:
    > http://publibz.boulder.ibm.com/cgi-b...y3mg32/5.1.1.8
    >
    >The "user expecting an ABEND if you "fall off" the end of the source code" is
    >the problem that I have heard of with OLD IBM mainframe code.


    In the days of GO TO spaghetti, there was a real danger of going into free fall. To guard
    against that, large programs had safety nets -- paragraphs that would abend because they
    should never have been fallen into.

    foo-exit.
    exit.

    foo-exit-safety-net.
    display 'Control fell out of foo '
    call 'abend'.

    Why did we ever have GO TO? It derived from assembly language. Hardware engineers had an
    unseen role in the design of Cobol. It took more than a decade to figure out that GO TO
    was a bad idea. Thirty years later, we still don't undrstand why the more subtle PERFORM,
    derived from Basic GOSUB, is a bad idea. It's a bad idea for the same reason slavery was
    bad: we don't need second class entities. The system works better when all logic entities
    have the same structure and standing.


    >--
    >Bill Klein
    > wmklein <at> ix.netcom.com
    >"Robert" <no@e.mail> wrote in message
    >news:gq54e3tujvakviekt9uklks3hv2vlracur@4ax.com...
    >> On Fri, 7 Sep 2007 12:59:30 -0400, "Rick Smith" <ricksmith@mfi.net> wrote:
    >>
    >>>Note that, if declaratives are used and there is only
    >>>one section for the body of the procedure division,
    >>>EXIT SECTION will transfer control to the end of
    >>>that section as required by 2002, EXIT statement
    >>>GR(12). This will, in effect, transfer control to the
    >>>explicit GOBACK statement that occurs at the end
    >>>of the source element, as described in 2002, 14.5.3,
    >>>last paragraph.

    >>
    >> Old School Cobol programmers have an almost genetic belief that the last line
    >> of a program
    >> must be its exit. I've seen this structure thousands of times:
    >>
    >> procedure division.
    >> main-line. *> non-functional paragraph name
    >> perform beginning-of-program
    >> perform middle-of-program
    >> perform end-of-program.
    >> ....
    >> end-of-program.
    >> goback.
    >> * --- last line in source code ---
    >>
    >> Why don't they say GO TO end-of-program, or just say goback in main-line?
    >>
    >> Why don't they understand that temporal cohesion is a poor way to structure a
    >> program?
    >> Cohesion is supposed to be functional.
    >>
    >> Now that goback at the end is in the Standard, their instictive belief has
    >> been
    >> vindicated. They'll cite it as proof they were Right all along.

    >



  8. Default Re: EXIT SECTION/PARAGRAPH

    In article <gq54e3tujvakviekt9uklks3hv2vlracur@4ax.com>,
    Robert <no@e.mail> wrote:
    >On Fri, 7 Sep 2007 12:59:30 -0400, "Rick Smith" <ricksmith@mfi.net> wrote:
    >
    >>Note that, if declaratives are used and there is only
    >>one section for the body of the procedure division,
    >>EXIT SECTION will transfer control to the end of
    >>that section as required by 2002, EXIT statement
    >>GR(12). This will, in effect, transfer control to the
    >>explicit GOBACK statement that occurs at the end
    >>of the source element, as described in 2002, 14.5.3,
    >>last paragraph.

    >
    >Old School Cobol programmers have an almost genetic belief that the last
    >line of a program
    >must be its exit. I've seen this structure thousands of times:
    >
    >procedure division.
    >main-line. *> non-functional paragraph name
    > perform beginning-of-program
    > perform middle-of-program
    > perform end-of-program.
    >....
    >end-of-program.
    > goback.
    >* --- last line in source code ---
    >
    >Why don't they say GO TO end-of-program, or just say goback in main-line?


    I barely know why *I* say things, Mr Wagner, let alone anyone else... but
    many's the time I've been on a site where the standard was:

    PROCEDURE DIVISION.

    PERFORM 0000-HOUSKEEPING THRU 0000-EX.
    PERFORM 3000-MAIN-LINE THRU 3000-EX.
    PERFORM 9999-EOJ THRU 9999-EX.
    GOBACK.

    3000-MAIN-LINE. <== note 'out-of-sequence' numbering. The reason given
    for this is that Housekeeping is done once and should be 'out of the way'
    (farther down in the source), EOJ is at the end and, likewise, farther
    down... and most problems occur in the mainline, so keep that more
    convenient than the other paragraphs.

    >
    >Why don't they understand that temporal cohesion is a poor way to
    >structure a program?


    The way that a program's skeleton was put together, decades on back, just
    might possibly not reflect the current programmers' understandings.

    >Cohesion is supposed to be functional.


    Mr Wagner, this is not a world where, in my experience, 'supposed to be'
    is actualised often enough that the lack of this occurring is worthy of
    much note... perhaps our experiences are different.

    >
    >Now that goback at the end is in the Standard, their instictive belief has been
    >vindicated. They'll cite it as proof they were Right all along.


    As long as the checks clear the bank, Mr Wagner, a Real Programmer might
    not see much more in 'what they cite' than noise.

    DD


  9. Default Re: EXIT SECTION/PARAGRAPH



    "Robert" <no@e.mail> wrote in message
    news:m9s4e31kd9spf9011fb891re7ktpsdt81g@4ax.com...
    > On Sat, 08 Sep 2007 07:10:31 GMT, "William M. Klein"
    > <wmklein@nospam.netcom.com> wrote:
    >
    >>Interesting. I have NEVER seen that structure. I almost always see
    >>either a
    >>"perform 999-End-Of-Program" - that never comes back - but includes
    >>closes and
    >>GOBACK, etc.

    >
    > Same as my example. I omitted closes to illustrate the point.
    >
    >>Or I see the GOBACK at the end of the mainline.

    >
    > That's where it belongs. Entry was at main-line, so exit should be at the
    > same level.
    >
    > The fundamental problem is PERFORM, a degraded form of CALL. If paragraphs
    > had been
    > CALLed, they would have received as much respect as programs. Moreover, we
    > could have
    > passed parameters to them. Instead of being forced to write:
    >
    > move x to foo-input
    > perform foo
    > move foo-output to y
    >
    > We should have written
    >
    > call foo using x, y
    >
    >>FYI,
    >> You might want to look at the section "5.1.1.8 Implicit EXIT PROGRAM"
    >> in the
    >>COBOL Migration Guide at:
    >>
    >> http://publibz.boulder.ibm.com/cgi-b...y3mg32/5.1.1.8
    >>
    >>The "user expecting an ABEND if you "fall off" the end of the source code"
    >>is
    >>the problem that I have heard of with OLD IBM mainframe code.

    >
    > In the days of GO TO spaghetti, there was a real danger of going into free
    > fall. To guard
    > against that, large programs had safety nets -- paragraphs that would
    > abend because they
    > should never have been fallen into.
    >
    > foo-exit.
    > exit.
    >
    > foo-exit-safety-net.
    > display 'Control fell out of foo '
    > call 'abend'.
    >
    > Why did we ever have GO TO? It derived from assembly language. Hardware
    > engineers had an
    > unseen role in the design of Cobol. It took more than a decade to figure
    > out that GO TO
    > was a bad idea. Thirty years later, we still don't undrstand why the more
    > subtle PERFORM,
    > derived from Basic GOSUB, is a bad idea. It's a bad idea for the same
    > reason slavery was
    > bad: we don't need second class entities. The system works better when all
    > logic entities
    > have the same structure and standing.


    That's an interesting opinion and very well stated.

    I thought about it and I can't agree. :-)

    I don't see PERFORM as a second class citizen at all, and have been very
    glad to use it in COBOL programs over decades.

    I can't see...
    CALL foo
    USING parm1 parm2 parm3
    ON EXCEPTION
    CALL something-else
    VARYING parm1
    FROM 1
    BY 1
    UNTIL parm1 > 1000
    AFTER parm2
    FROM 1
    BY 1
    UNTIL parm2 > 1000
    AFTER parm3
    FROM 1
    BY 1
    UNTIL parm3 > 1000
    END-CALL

    ...as having quite the same elegance.

    I believe there is a place for calling something external, and there is a
    place for using something internal and the two are of equal Class and
    standing.

    Of course, people who are persuaded by your argument are not REQUIRED to use
    PERFORM.

    (COBOL is very democratic that way... :-))

    Pete.
    --
    "I used to write COBOL...now I can do anything".



  10. Default Re: EXIT SECTION/PARAGRAPH

    In article <m9s4e31kd9spf9011fb891re7ktpsdt81g@4ax.com>,
    Robert <no@e.mail> wrote:

    [snip]

    >The fundamental problem is PERFORM, a degraded form of CALL.


    Mr Wagner, it might well be argued that 'PERFORM' is no more 'a degraded
    form of CALL' in the same wise that 'any way to transfer control from the
    currently executing statement' is 'a degraded form of (branch
    instruction)'.

    Such arguments may, perhaps, be able to give their originators and/or
    participants a 'such a clever lad I am!' feeling... but be of limited
    application once the client starts paying for time. Philosophising, for
    some, is an enjoyable thing but, as Wittgenstein said, 'The bridge must
    not fall down'... this has been pointed out in response to your postings
    previously.

    >If
    >paragraphs had been
    >CALLed, they would have received as much respect as programs.


    If my Sainted Paternal Grandmother - may she sleep with the angels! - had
    wheels then she'd have been a trolley-car.

    She didn't.

    DD

+ Reply to Thread
Page 1 of 6 1 2 3 ... LastLast

Similar Threads

  1. Configuration Section
    By Application Development in forum CSharp
    Replies: 3
    Last Post: 09-25-2007, 03:06 PM
  2. Section Markers
    By Application Development in forum Adobe Indesign
    Replies: 1
    Last Post: 09-15-2007, 12:32 PM
  3. C++ Primer section 1.6 example
    By Application Development in forum c++
    Replies: 1
    Last Post: 07-13-2007, 10:15 AM
  4. Stroustrup's TC++PL(se) section 4.4
    By Application Development in forum c++
    Replies: 5
    Last Post: 07-01-2007, 10:20 AM
  5. Unanchored frame in paragraph format, but notbelow or above paragraph
    By Application Development in forum Adobe Framemaker
    Replies: 1
    Last Post: 01-03-2007, 02:29 PM