Re: Help! GO TO and PERFORM THRU!




"Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> wrote in message
news:553380F236v7tU1@xxxxxxxxxxxxxxxxxxxxx
Charles Hottel<chottel@xxxxxxxxxxxxx> 03/03/07 7:24 PM >>>

"Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54p7lrF21d53dU1@xxxxxxxxxxxxxxxxxxxxx

"Howard Brazee" <howard@xxxxxxxxxx> wrote in message
news:qjrdu2172daq1ae22ebqnn7r6uiki905g1@xxxxxxxxxx
On Thu, 1 Mar 2007 12:15:37 +1300, "Pete Dashwood"
<dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I couldn't disagree more.

About the flag or the style mix :-)?

I like full stop periods within paragraphs - and always use END-IFs
with my IFs.

Fair enough. A personal preference.

As you may have gathered, I disagree. I think periods were a major cause

of error in "old" COBOL and the fewer you have of them, the better. The
only requirement now (in the Procedure Division...) seems to be
immediately preceding a paragraph/section name and I reckon that is
great.

Why would I prefer fewer periods (full stops)...?

1. With some of the old impact printers they didn't render properly and
were easily missed. Sure, that is much less of a problem these days when

we print listings with laser printers, but I have lingering suspicions
of

any program listing. Fortunately, I never use COBOL listings these days
and haven't for many years... Still, reducing the periods reduces any
real
or imagined risk and makes me feel better :-).

2. Using an end-of-statement terminator (full stop) (which is small and
easily missed) rather than a scope delimiter (which is easily visible
and

logically sensible) makes cutting and pasting code much more error
prone.

3. Using both scope delimiters and full stops just seems ugly and
unnecessary to me.

I think using END-IF is a step in the right direction, but why not take
a

few more steps and use ALL of the scope delimiters? Before you know it
you
are thinking in logical scope blocks (just as you would in a modern
language), and periods are just an ugly irrelevance in the middle of
your

code... :-)

Pete.


There are many ways to write a nested IF statement. Here is one style I
have
seen (with the ending left unfinished):

IF
stmts
ELSE IF
stmts
ELSE IF
stmts
ELSE IF
stmts
ELSE IF
stmts

How would you choose to end something like this?

1. You could just put a period at the end of the last statement in the
last

ELSE IF.

2. You could code END-IF with a period.

3. You could code an END-IF for each IF all on one line, with or without a

period after the last one. The more IFs the more chance of getting it
wrong

and the harder it will be to read. Of course the IBM mainframe compiler
shows you a nesting level number to aid in this type of thing.

4. You could use EVALUATE instead.

EVALUATE TRUE
WHEN ...
stmts
WHEN ...
stmts
WHEN ...
stmts
WHEN ...
stmts
WHEN ...
stmts
END-EVALUATE

Frank


Gosh! you mean like LX-1 and myself suggested 3 days ago in this thread?

There has been a whole debate sparked by this... We moved from using
EVALUATE to whether or not you should agree to perpetuate bad practice. You
really must keep up, Frank... :-)

Pete.


.