From: Sean Conner
Sent: Wednesday, February 18, 2015 8:56 AM
It was thus said that the Great Chuck Guzis once
stated:
> Is there any other language (save PL/I for obvious
reasons) that has an
> equivalent to the COBOL PERFORM...THRU statement?
> That one always struck me as being a bit offbeat.
Example: Consider a
> section of a program with 4 consecutive paragraphs, named PARA-1 through
> PARA-4. One can say in the same program:
> PERFORM PARA-2 THRU PARA-3 WITH TEST AFTER VARYING
INDEX-1 FROM 10 BY 3
^^^^^^^^^ ^^^^^
> UNTIL FLAG-1 > 0.
Syntax error. The syntax of the PERFORM verb in this case is
PERFORM paragraph-1 [{THRU,THROUGH} paragraph-2]
VARYING {identifier-1, index-name-1} FROM {identifier-2,
index-name-2,
literal-1}
BY {identifier-3,
index-name-3,
literal-2}
UNTIL condition-1
[AFTER VARYING {identifier-4, index-name-4} FROM {identifier-5
index-name-5
literal-3}
BY {identifier-6,
index-name-6,
literal-4}
UNTIL condition-2
[AFTER VARYING {identifier-7, index-name-7} FROM {identifier-8
index-name-8
literal-5}
BY {identifier-9,
index-name-9,
literal-6}
UNTIL condition-3]]
.
Braces indicate alternatives, brackets indicate optional portions of the statement.
An AFTER VARYING clause can only occur in a 2nd or 3rd position following
the 1st VARYING clause.
There is no "WITH xxxx" in the 1968 or 1974 CODASYL standard; did that come
into the language in 1985 or later? Never mind, I just checked the IBM COBOL
reference manual, based on the 1985 standard, and do not see it there, either.
index_1 = 10
^^^^^^^^^^^^
repeat
para_2()
para_3()
index_1 -= 3
until flag_1 > 0
Sean forgot to initialize index_1 to 10 before beginning the repeat ... until
loop.
Rich
Rich Alderson
Vintage Computing Sr. Systems Engineer
Living Computer Museum
2245 1st Avenue S
Seattle, WA 98134
mailto:RichA at
LivingComputerMuseum.org
http://www.LivingComputerMuseum.org/