Mail Archives: djgpp/1999/07/30/02:23:03
Judson McClendon wrote in message ...
>Martijn Lievaart wrote:
>>
>>[1] For the cobol gurus out there, what does this peace of code do
>>(except for syntax errors, it has been a while since I wrote COBOL,
>>you'll get the meaning)
>>
>>PERFORM xxxxx VARYING I FROM 1 TO 9
>> VARYING J FROM I+1 TO 10.
>
>This is COBOL 85 PERFORM statement format 4, written like this:
>
> PERFORM xxxxx
> VARYING I FROM 1 BY 1 UNTIL I > 9
> AFTER J FROM I + 1 BY 1 UNTIL J > 10.
>
>However, you cannot use the expression (I + 1) there in standard
>COBOL 85; it must be a numeric literal, data name or index name.
Aah, I shouldn't have posted that, I don't remember the syntax exact enough
to make a meaningfull statement. Hmm, this must have been the statement, and
we looked it up in the standard so it couldn't have been a compiler
extension. Shame I don't remember it exactly, as I take your word that this
is non-standard.
(snip)
>
>Just the logic you would use for a bubble sort. :-)
Bublesort was the original context.It was in pre-84 COBOL, and it did:
I J
-- --
1 2
1 3
...
1 9
1 10
2 2
2 3
2 4
...
2 9
2 10
3 3
3 4
...
9 9
9 10
Very surprising if you don't know it, but very ISO complient. We had to look
it up in the standard, and the compiler was right. The first time through
the loop, I was set and then J calculated. Each following iteration J was
calculated before incrementing I.
BTW before anyone thinks something wrongly of this thread, let me make
absolutely clear that this example was intended humorous, and absolutely not
as COBOL bashing. The things I could tell you about C++........ ;^>
Martijn
--
Please post replies to this newsgroup. If you must reach me by email, use
<newsgroup-name> at greebo.orion in nl.
Senders of unsollicited bulk or commercial email will be prosecuted to the
maximal extend possible by law and any other means.
- Raw text -