From: Pete Dashwood on

Does anyone have a favourite way of specifying that a PERFORM should
continue indefinitely?

Consider the following code:

move low-values to wpppauthorblurb
perform until 1 = 2
perform get-input
if itsa-tag OR finished
exit perform
end-if
string
wpppauthorblurb
delimited by low-values
INPUT-RECORD (1:INPUT-LEN)
delimited by size
'<br> '
delimited by size
into
wpppauthorblurb
end-string
end-perform

The first PERFORM should keep going until it is exited by the EXIT PERFORM
on line 5.

The best I could do on the spot was create a condition that can never be
true (1 = 2), but I think this is pretty lame...:-)

This is Fujitsu NetCOBOL but I'd be interested in seeing any solutions
anyone has.

PERFORM FOREVER would be cool...

Pete.



From: Arnold Trembley on


Pete Dashwood wrote:

>
> Does anyone have a favourite way of specifying that a PERFORM should
> continue indefinitely?
>
> Consider the following code:
>
> move low-values to wpppauthorblurb
> perform until 1 = 2
> perform get-input
> if itsa-tag OR finished
> exit perform
> end-if
> string
> wpppauthorblurb
> delimited by low-values
> INPUT-RECORD (1:INPUT-LEN)
> delimited by size
> '<br> '
> delimited by size
> into
> wpppauthorblurb
> end-string
> end-perform
>
> The first PERFORM should keep going until it is exited by the EXIT PERFORM
> on line 5.
>
> The best I could do on the spot was create a condition that can never be
> true (1 = 2), but I think this is pretty lame...:-)
>
> This is Fujitsu NetCOBOL but I'd be interested in seeing any solutions
> anyone has.
>
> PERFORM FOREVER would be cool...
>
> Pete.

My favorite way involved defining a condition name.

PERFORM UNTIL INFINITE-LOOP-DONE

Others might prefer a condition name such as HELL-FREEZES-OVER or
DOCDWARF-GETS-THE-LAST-WORD. The actual definition of the condition
name is an exercise left to the programmer, but like all old mainframe
programmers, I prefer a one character alphanumeric field.

With kindest regards, and apologies to DocDwarf...

--
http://arnold.trembley.home.att.net/

From: Richard on
> This is Fujitsu NetCOBOL but I'd be interested in seeing
> any solutions anyone has.
>
> PERFORM FOREVER would be cool...

Then look in your Fujitsu manual, Format 5 is:

PERFORM WITH NO LIMIT

IMHO the EXIT PERFORM is poor usage and should be put in the same bin
as GO TO, NEXT SENTENCE, EXIT PARAGRAPH and EXIT SECTION (and a few
others).

For example, if I wanted to reuse part or all of the imperitive
statement in the in-line PERFORM I could extract it and make it a
performable paragraph. My definition of 'clean code' is that which can
be moved without regard to any positional dependencies. The EXIT
PERFORM is not clean code, it would fail to work as designed if moved
to a paragraph.

(Actually I think it would continue to work correctly in Unisys if I
understood what was said).

From: Richard on
> perform until 1 = 2

Some compilers may notice this and could either 1) optimize it as
always false or 2) flag an error that comparing two literals is
obviously wrong.

From: Richard on
> DOCDWARF-GETS-THE-LAST-WORD

Doesn't that always get to be true eventually, no matter how it takes ?