Re: Help! GO TO and PERFORM THRU!
- From: "Michael Mattias" <mmattias@xxxxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 17:53:42 GMT
"Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54k8niF20o965U1@xxxxxxxxxxxxxxxxxxxxx
the mixing of scope-delimited COBOL with full-stop-terminated COBOL is
ugly and confusing..
Amen.
I find the same thing in BASIC.
These mean the same thing...
IF Condition1 THEN
DoSomething1
END IF
(called 'block if')
and
IF Condition1 THEN DoSomething1
(called "single-line if")
But you can mix and match and boy, that IS confusing...
IF Condition1 THEN
IF Condition2 THEN DoSomething2 <<< Executed only when both
Condition1 and Condition2 are true
DoSomething1 <<< Executed whenever
condition1 is true regardless of condition2
END IF
Of course in Real Life the distance between "IF Condition1" and its
companion END IF is many many lines of source code. Darned near impossible
to figure out what the logic flow is in that case.
It gets worse when (sadly) the single-line IF includes an EXIT or GOTO
statement, eg
IF Condition1 THEN
IF Condition2 THEN DoSomething2: EXIT
DoSomething1
END IF
BASIC EXIT is similar to COBOL EXIT "structure type" (e.g. PARAGRAPH,
PERFORM, SECTION) except 'structure type' is optional; when "structure
type" is omitted EXIT exits the current loop structure regardless of its
type (FOR, DO, IF, TRY, FUNCTION, SUB, SELECT or WHILE).
I tell others to use block IF or single-line IF - whatever they are comfy
with - but don't intersperse them like this.
MCM
.
- Follow-Ups:
- Re: Help! GO TO and PERFORM THRU!
- From: Richard
- Re: Help! GO TO and PERFORM THRU!
- From: Frank Swarbrick
- Re: Help! GO TO and PERFORM THRU!
- References:
- Help! GO TO and PERFORM THRU!
- From: Impy
- Re: Help! GO TO and PERFORM THRU!
- From: raul
- Re: Help! GO TO and PERFORM THRU!
- From: ruddy
- Re: Help! GO TO and PERFORM THRU!
- From: Pete Dashwood
- Help! GO TO and PERFORM THRU!
- Prev by Date: Re: Reset data
- Next by Date: Re: Help! GO TO and PERFORM THRU!
- Previous by thread: Re: Help! GO TO and PERFORM THRU!
- Next by thread: Re: Help! GO TO and PERFORM THRU!
- Index(es):
Relevant Pages
|