Should compiler complain about this? 
Author Message
 Should compiler complain about this?

This program compiles *without* any diagnostics (on a Tandem K2000).
Anyone care to predict the run-time results?

identification division.
program-id. test-perform-thru.
environment division.
data division.
procedure division.
a.
   perform c thru b 10 times.
   stop run.
b.
   display "paragraph b" .
c.
   display "paragraph c" .
d.
   display "paragraph d" .

Doug Miller

views expressed are mine and not those of
Hospital Health Plan Corp.  "all health care is local"



Mon, 07 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?


Quote:
> Anyone care to predict the run-time results?

> identification division.
> program-id. test-perform-thru.
> environment division.
> data division.
> procedure division.
> a.
>    perform c thru b 10 times.
>    stop run.
> b.
>    display "paragraph b" .
> c.
>    display "paragraph c" .
> d.
>    display "paragraph d" .

It should display

paragraph c
paragraph d

and then terminate normally.  There is no need for the compiler
to complain as there is nothing illegal or incorrect in the
program, except that paragraph a is misleading as to what the
results might be.

Need I say that this is one good reason to avoid PERFORM ... THRU.



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

> This program compiles *without* any diagnostics (on a Tandem K2000).
> Anyone care to predict the run-time results?

> a.
>    perform c thru b 10 times.
>    stop run.

I don't think you meant to say perform C thru B, did you?


Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

>Path: news.netdirect.net!news-out.internetmci.com!uwm.edu!math.ohio-state.edu!howland.erols.net!news.starnet.net!news.hn.netlink.co.nz!kcbbs!riplin
>Newsgroups: comp.lang.cobol
>Subject: Re: Should compiler complain about this?

>Date: 20 Dec 96 08:13:35 GMT


>Organization: Kappa Crucis Unix BBS, Auckland, New Zealand
>Lines: 31


>> Anyone care to predict the run-time results?

>> identification division.
>> program-id. test-perform-thru.
>> environment division.
>> data division.
>> procedure division.
>> a.
>>    perform c thru b 10 times.
>>    stop run.
>> b.
>>    display "paragraph b" .
>> c.
>>    display "paragraph c" .
>> d.
>>    display "paragraph d" .

>It should display

>paragraph c
>paragraph d

>and then terminate normally.

Correct.

Quote:
>There is no need for the compiler
>to complain as there is nothing illegal or incorrect in the
>program, except that paragraph a is misleading as to what the
>results might be.

Illegal, no. Incorrect, well, maybe. I doubt that it was the intent of the
designers of the language to allow PERFORM ... THRU with out-of-order
paragraphs. Hence my surprise that the compiler did not object.

Quote:
>Need I say that this is one good reason to avoid PERFORM ... THRU.

I have already emphasized that to the programmer responsible for this. :-)

Doug Miller

views expressed are mine and not those of
Hospital Health Plan Corp.  "all health care is local"



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?


Quote:
>Path: news.netdirect.net!news-out.internetmci.com!uwm.edu!www.nntp.primenet.com!nntp.primenet.com!news.mathworks.com!news.pbi.n...

>Newsgroups: comp.lang.cobol
>Subject: Re: Should compiler complain about this?
>Date: Fri, 20 Dec 1996 08:37:06 -0500
>Organization: Fidelity Investments
>Lines: 12


>NNTP-Posting-Host: jeffreyporter.fmr.com
>Mime-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>X-Mailer: Mozilla 3.01GoldC (Win95; I)


>> This program compiles *without* any diagnostics (on a Tandem K2000).
>> Anyone care to predict the run-time results?

>> a.
>>    perform c thru b 10 times.
>>    stop run.

>I don't think you meant to say perform C thru B, did you?

Yes, I did -- that's the point of the question in the title of the post:
        "Should the compiler complain about this?"

It's also the point of wondering if anyone cared to predict the results
of running the program; if it said 'b thru c' the results would be obvious.

Doug Miller

views expressed are mine and not those of
Hospital Health Plan Corp.  "all health care is local"



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

> Yes, I did -- that's the point of the question in the title of the post:
>         "Should the compiler complain about this?"

> It's also the point of wondering if anyone cared to predict the results
> of running the program; if it said 'b thru c' the results would be obvious.

Fat fingers have a way of destroying good intentions even you should
appreciate that fact.  It's always better to ask than assume.  

Why don't you save the flames for a more juvenile area.



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

>This program compiles *without* any diagnostics (on a Tandem K2000).
>Anyone care to predict the run-time results?

>identification division.
>program-id. test-perform-thru.
>environment division.
>data division.
>procedure division.
>a.
>   perform c thru b 10 times.
>   stop run.
>b.
>   display "paragraph b" .
>c.
>   display "paragraph c" .
>d.
>   display "paragraph d" .

>Doug Miller

>views expressed are mine and not those of
>Hospital Health Plan Corp.  "all health care is local"

don't know about tandem. BUT....perform c thru b?

entering at "C" and exiting at "B"....never get to B falling thru C
and D...impied stop run.   very fast...very useless...

JR

and stir with a Runcible spoon...



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

... lead-in with sample

 >> procedure division.

Quote:
> >> a.
> >>    perform c thru b 10 times.
> >>    stop run.
> >> b.
> >>    display "paragraph b" .
> >> c.
> >>    display "paragraph c" .
> >> d.
> >>    display "paragraph d" .

...
> >There is no need for the compiler
> >to complain as there is nothing illegal or incorrect in the
> >program, except that paragraph a is misleading as to what the
> >results might be.

> Illegal, no. Incorrect, well, maybe. I doubt that it was the intent of the
> designers of the language to allow PERFORM ... THRU with out-of-order
> paragraphs.

It was the intent.  It was felt that any restriction was not needed.  
It certainly can cause some surprises.

Quote:
>Hence my surprise that the compiler did not object.

The compiler cannot object.  The code is quite legal according to the
standard.  The compile would fail the audit tests if it objected.

Quote:
> >Need I say that this is one good reason to avoid PERFORM ... THRU.

Definitely true!

Quote:
> I have already emphasized that to the programmer responsible for this. :-)

And any other misuses of PERFORM, which tend to be legion.

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

No clever quotes here



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Why all the fuss about the PERFORM THRU?  At my shop we use it as the
standard and we all find it quite readable.  As for the example, if
that's the best the programmer can code, then you get what you deserve.



Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

> It should display

> paragraph c
> paragraph d

> and then terminate normally.  There is no need for the compiler
> to complain as there is nothing illegal or incorrect in the
> program, except that paragraph a is misleading as to what the
> results might be.

> Need I say that this is one good reason to avoid PERFORM ... THRU.

Some systems may NOT terminate abnormally. This will usually generate
a abend on an IBM mainframe (most likely a 0C4).

--
Alex




Tue, 08 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?

Quote:

> Why all the fuss about the PERFORM THRU?  At my shop we use it as the
> standard and we all find it quite readable.  As for the example, if
> that's the best the programmer can code, then you get what you deserve.


PERFORM THRU as opposed to the PERFORM by itself -- makes everything much
clearer, and (!), you can add paragraphs much more freely.

As for a 'programmer' not being able to debug the sample code shown: any
programmer who'd get confused by that, needs to be shown the door, 'cause
that person ain't no programmer.



Wed, 09 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?


Quote:
> >> a.
> >>    perform c thru b 10 times.
> >>    stop run.
> >> b.
> >>    display "paragraph b" .
> >> c.
> >>    display "paragraph c" .
> >> d.
> >>    display "paragraph d" .
> Illegal, no. Incorrect, well, maybe. I doubt that it was the intent of the
> designers of the language to allow PERFORM ... THRU with out-of-order
> paragraphs. Hence my surprise that the compiler did not object.

If a 'GO TO b.' is added at the end of paragraph c, then the program
will function as paragraph a may lead you to believe.

If this was added to the end of paragraph d, it would also do
the perform 'correctly'.  Paragraphs are only 'out of order'
because you tend to work top to bottom.  The compiler cannot
tell that this is incorrect because a 'GO TO B' *anywhere* may
correctly close the loop.

What specifically did you think the compiler should object to ?



Thu, 10 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?


Quote:
>Path: news.netdirect.net!news.sprintlink.net!news-chi-13.sprintlink.net!www.nntp.primenet.com!nntp.primenet.com!howland.erols.net!worldnet.at...

>Newsgroups: comp.lang.cobol
>Subject: Re: Should compiler complain about this?
>Date: Sat, 21 Dec 1996 17:15:38 -0500
>Organization: AT&T WorldNet Services
>Lines: 13


>NNTP-Posting-Host: 207.146.65.193
>Mime-Version: 1.0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>X-Mailer: Mozilla 2.01E (Win95; I)


>> Why all the fuss about the PERFORM THRU?  At my shop we use it as the
>> standard and we all find it quite readable.  As for the example, if
>> that's the best the programmer can code, then you get what you deserve.


>PERFORM THRU as opposed to the PERFORM by itself -- makes everything much
>clearer, and (!), you can add paragraphs much more freely.

>As for a 'programmer' not being able to debug the sample code shown: any
>programmer who'd get confused by that, needs to be shown the door, 'cause
>that person ain't no programmer.

I quite agree; unfortunately, I am not in a position to make such decisions in
regard to the individual responsible for the code that prompted this post. :-(

That is, of course, a separate issue from the question of whether the compiler
should issue a diagnostic in this situation. I still feel that it should, on the grounds
that 'PERFORM x THRU y' where y *precedes* x is guaranteed to fail in the
absence of a hypothetical GOTO transferring control back to y. I recognize,
however, that the ANSI standards commitee does not share this opinion. :-)

Doug Miller

views expressed are mine and not those of
Hospital Health Plan Corp.  "all health care is local"



Fri, 11 Jun 1999 03:00:00 GMT  
 Should compiler complain about this?



Quote:

writes:
> > Anyone care to predict the run-time results?
> It should display

> paragraph c
> paragraph d

> and then terminate normally.  There is no need for the compiler
> to complain as there is nothing illegal or incorrect in the
> program, except that paragraph a is misleading as to what the
> results might be.

> Need I say that this is one good reason to avoid PERFORM ... THRU.

No you don't.
But how about this spaghetti...

        identification division.
        program-id. test-perform-thru.
        environment division.
        data division.
        procedure division.
        a.
           perform c thru b 10 times.
           stop run.
        b.
           display "paragraph b" .
        c.
           display "paragraph c" .
        d.
           display "paragraph d" .
           go to b.

It should work with most Cobol-dialects.
Though to make matters worse you might try this one:

        identification division.
        program-id. test-perform-thru.
        environment division.
        data division.
        procedure division.
        a.
           perform c thru b 10 times.
           stop run.
        b.
           display "paragraph b" .
           alter e to d.
        c.
           display "paragraph c" .
           go to e.
        d.
           display "paragraph d" .
           alter e to b.
        e.
           go to d.

Can you still folow it...
It will still work but you wouldn't want this kind of code for anything
other
than a obfuscated-Cobol-contest ;-)

CU

Martin



Fri, 11 Jun 1999 03:00:00 GMT  
 
 [ 19 post ]  Go to page: [1] [2]

 Relevant Pages 

1. NAG Fortran Compiler complains :-(

2. gcc compiler complains about tclDecls.h

3. cobol650 compiler never complain

4. Right to Complain

5. Complain to don@comla

6. to whitch address I can make complains about jclscan

7. Two complains ???

8. For those who complain about windows

9. if you ever complained about the signal/noise ratio

10. Word complaining that Share not loaded if write-protected hard disk

11. cobol650 never complain a bug.

12. If you want to see Python people complaining...

 

 
Powered by phpBB® Forum Software