Sections 
Author Message
 Sections

How do I exit a section??
Can I treat it like a perform statement?
I mean I do not think you can say

PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.

Thank you



Sat, 15 May 1999 03:00:00 GMT  
 Sections

Quote:

> How do I exit a section??

By falling through the end of it.  Most people put an EXIT statement
at the end.  Like this.

frammis SECTION.
a-paragraph.
    ...  (some code)
    GO TO frammis-exit
    .
another-paragraph.
    ...  (some more code)
frammis-exit.
    EXIT
    .

Note that CONTINUE can be used instead of EXIT.  However, if you read
this group regularly you will find that people get really fired up
over sections, GO TOs, and the like.  Some love sections, some hate
them, and some are in the middle.

Another way that exists in many compilers and will be in the next
standard is to use EXIT SECTION anywhere in the section.

Quote:
> Can I treat it like a perform statement?

A bit unclear as to what you mean.

Quote:
> I mean I do not think you can say

> PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.

A section-name is like any other procedure-name.  You can reference it
in a GO TO, a PERFORM, a SORT, and so on.

--
Don Nelson
COBOL Development, Tandem Computers, Inc.
Member, ANSI X3J4 and ISO/IEC JTC1/SC22 WG4 COBOL Committees

No clever quotes here



Sat, 15 May 1999 03:00:00 GMT  
 Sections

: How do I exit a section??
: Can I treat it like a perform statement?

Yes, you can PERFORM a section, if that's what you mean.

: I mean I do not think you can say
: PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.

Yes, you can, but leave out the word "SECTION".  The return will
occur after the last statement of the last paragraph of MAIN-LINE.

Walter Murray



Sat, 15 May 1999 03:00:00 GMT  
 Sections

IF you are using Micro-Focus COBOL use

Exit Section.

If not, you cane use a GO TO to a label at the end of the section.  

Or, alternatively, you can re-code so that is not necessary.



Quote:
> How do I exit a section??
> Can I treat it like a perform statement?
> I mean I do not think you can say

> PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.

> Thank you



Sun, 16 May 1999 03:00:00 GMT  
 Sections

Quote:

>How do I exit a section??
>Can I treat it like a perform statement?
>I mean I do not think you can say
>PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.
>Thank you

Why do you need sections?  Are you using a '74 compiler in a SORT?
Besides it's "PERFORM MAIN-LINE UNTIL CONTROL-VARIABLE = 20."  The
clause "SECTION" goes in the paragraph title starting at column 8:
MAIN-LINE SECTION.

Just my 1.5 cents worth, adjusted for inflation
Boyce G. Williams, Jr.

 .---------------------------------------------------------------------.
 | "People should have two virtues:  purpose- the courage to envisage  |
 | and pursue valued goals uninhibited by the defeat of infantile      |
 | fantasies, by guilt and the failing fear punishment;  and wisdom- a |
 | detached concern with life itself, in the face of death itself."    |
 |                                                     Norman F. Dixon |
 '---------------------------------------------------------------------'



Fri, 21 May 1999 03:00:00 GMT  
 Sections


Quote:


> >How do I exit a section??
> >Can I treat it like a perform statement?
> >I mean I do not think you can say

> >PERFORM MAIN-LINE SECTION UNTIL CONTROL-VARIABLE = 20.

> >Thank you

> Why do you need sections?  Are you using a '74 compiler in a SORT?
> Besides it's "PERFORM MAIN-LINE UNTIL CONTROL-VARIABLE = 20."  The
> clause "SECTION" goes in the paragraph title starting at column 8:
> MAIN-LINE SECTION.

> Just my 1.5 cents worth, adjusted for inflation
> Boyce G. Williams, Jr.

>  .---------------------------------------------------------------------.
>  | "People should have two virtues:  purpose- the courage to envisage  |
>  | and pursue valued goals uninhibited by the defeat of infantile      |
>  | fantasies, by guilt and the failing fear punishment;  and wisdom- a |
>  | detached concern with life itself, in the face of death itself."    |
>  |                                                     Norman F. Dixon |
>  '---------------------------------------------------------------------'

Well said...However I found that in VS Cobol II one needs to have
Sections in the Procedure Division.  That's what I was told anyway.  If
anyone knows better, feel free to let me know.

Sections works well, although I found on RM-Cobol you need another trick
to make them work:

PERFORM A10-TEST UNTIL ...

A10-TEST SECTION.
A10-START.
  ...
  ...
A10-END.
    EXIT.

This seems to be a neet way of solving the problem and it is compatible
with compilers that needs sections.  I don't like the EXIT SECTION or GO
TO statements because I believe that is a result of bad planning.  I
never use them and never needed to until now.  I believe I will always
findd a way past them...

Freddie
:)



Sun, 23 May 1999 03:00:00 GMT  
 Sections


Quote:
> Well said...However I found that in VS Cobol II one needs to have
> Sections in the Procedure Division.  That's what I was told anyway.  If
> anyone knows better, feel free to let me know.

While it is not impossible that a compiler requires a SECTION header
between the PROCEDURE DIVISION and the first paragraph, it is not
necessary that you then need to use sections to perform.  The
program could be all one section.

I recall the ICL XE13 compiler which was OK if the program was
only paragraphs and was OK if there was a SECTION immediately
after PROCEDURE DIVISION but gave very strange results if the
program started with a paragraph and then a SECTION was later
declared.

Quote:

> Sections works well, although I found on RM-Cobol you need another trick
> to make them work:

> PERFORM A10-TEST UNTIL ...

> A10-TEST SECTION.
> A10-START.
>   ...
>   ...
> A10-END.
>     EXIT.

> This seems to be a neet way of solving the problem and it is compatible
> with compilers that needs sections.  I don't like the EXIT SECTION or GO
> TO statements because I believe that is a result of bad planning.  I
> never use them and never needed to until now.  I believe I will always
> findd a way past them...

I am completely mystified, what is the 'trick' ?


Tue, 25 May 1999 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Value clause in File section and Linkage section

2. WhySmalltalk.com Jobs Section

3. Dummy section assembler directives

4. dummy section directives

5. Extract section from a file

6. How to ignore quoted sections?

7. Printing a section of line between start/end strings

8. Setting filename on the BEGIN section?

9. New WhySmalltalk.com section

10. Duplicate detail section in Report

11. 2nd Detail section on Report

 

 
Powered by phpBB® Forum Software