delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/30/02:23:03

From: "Martijn Lievaart" <nobody AT greebo DOT orion DOT nl>
Newsgroups: comp.os.msdos.djgpp,alt.comp.lang.learn.c-c++,alt.lang.basic
Subject: Re: A small bussiness billing application
Date: 29 Jul 1999 10:21:43 GMT
Organization: EuroNet Internet
Lines: 69
Message-ID: <7np9vn$e3m@news3.euro.net>
References: <8E0A6B90Bjsampsonpostmasterco AT news DOT earthlink DOT net> <OdFl3.2157$xN4 DOT 20163 AT news3 DOT mia> <9APl3.1054$XG6 DOT 30509 AT dfiatx1-snr1 DOT gtei DOT net> <90_l3.4474$xN4 DOT 43628 AT news3 DOT mia> <7na84u$4d7 AT news3 DOT euro DOT net> <km2m3.3538$hy DOT 30259 AT news4 DOT mia> <7nn6i2$9il AT news3 DOT euro DOT net> <R6Jn3.7744$mo6 DOT 54765 AT news3 DOT mia>
NNTP-Posting-Host: p227.asi.euronet.nl
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019