Hi Mark, GOTO-phobia (love that term :-) Don't know about you, but I have seen programs that were 5000 lines long, filled with goto's that needed upgrading to fit a new release and required hundreds of hours to upgrade instead of 20. When done, they became very 'quirky' and impossible to debug. Finally after user complaints, 400 hours were invested to completely rewrite. And at $175 per hour, 400 hours is a big loss to a software house - "blood on the highway" as the owner used to say. So whereas goto's are not 'bad', bad programming is VERY bad.
Usually with sorts I just form the key that defines the break-points after every read. The first time through you prime the key and kill the first flag, after that when the key changes you print the totals, set the key to the value that caused the break, clear the totals while adding to the grand total(s) and then add the values for the current record to the just cleared totals and voila. Done deal ! Nest this logic and you can do multi-sort-breaks. I learned this method very well as before I came to the Pick community (as it *used* to be called) I was working on a system that had no query language. And the CEO was a big believer in sales analysis reports of every imaginable sorts. Plus, every once in a while you run into someone that wants the a column for "This division sales percent of the territory total" and "This territory sales percent of the Grand Total", etc. which are pretty much impossible without programming. That said, I still believe in using Uniquery for reports as much as possible. Keep is simple whenever possible! But, really when you get down to it, it just doesn't really matter how you get something done. It's the analytical mindset, business experience and attention to details that really make a good programmer. IMHO! Allen -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mark Johnson Sent: Thursday, June 17, 2004 5:12 PM To: [EMAIL PROTECTED] Subject: Re: [U2] [UV] WHILE READNEXT id DO Very good question. Is BASIC Structured. And who defines the structures. I was on a phone interview with a prospective employer a few years ago and during that conversation he brought up the concept of GOTO's. I completely understand GOTO's (most on this forum are GOTO-phobic) and use them sparingly. That turned the tide of the interview. Despite my 20+ years (at that time) of MV programming, he couldn't get off the GOTO-less soapbox. Since the interview got a little pissy towards the end, I asked him if he ever drank a beer. His yes answer then allowed me to label him an alcoholic as clearly alcoholics drink beer. Do GOTO's make one a poor programmer or do poor programmers use GOTO's. I've seen a lot of GOTO-less code that is very sloppy with its over-use of FLAGS to skirt around code sections. I've also seen well written code with a few GOTO's placed in appropriate places. This appears to be the semi-annual GOTO holy war. I'm capable of learning so I would like for someone to offer me some code segments to perform the following MVquery statement as a true data/basic program: SORT CUSTOMER BY STATE BY CITY NAME BREAK-ON CITY BREAK-ON STATE TOTAL YTD-SALES I really would like to see how the other side programs this. thanks in advance. ----- Original Message ----- From: "Glenn Herbert" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 17, 2004 3:00 PM Subject: RE: [U2] [UV] WHILE READNEXT id DO > Is BASIC structured? :-p > > If your answer is yes, then the GOTO should probably not be allowed (except > in rare cases). > > If your answer is no, then GOTO away!! (caveat: if not abused!) > > As Yoda says: GOTO is the evil not; incorrect the usage is! > > At 02:46 PM 6/17/2004, you wrote: > >You realize this does not conform to the ANSI structured programming > >principles? I have a version dated 1982 and goto's are not allowed... > > > >Or was this just a joke? In which case you certainly got me! :-) > > > >-----Original Message----- > >From: [EMAIL PROTECTED] > >[mailto:[EMAIL PROTECTED] Behalf Of Simon Lewington > >Sent: Thursday, June 17, 2004 11:02 AM > >To: [EMAIL PROTECTED] > >Subject: Re: [U2] [UV] WHILE READNEXT id DO > > > > > ><[EMAIL PROTECTED]> ... > > > LOOP > > > code > > > WHILE READNEXT id DO > > > more code > > > REPEAT > > > >I prefer: > > > >100 > >[code] > >GOTO 300 > >200 > >[more code] > >GOTO 100 > >300 > >READNEXT ID THEN GOTO 200 > >------- > >u2-users mailing list > >[EMAIL PROTECTED] > >To unsubscribe please visit http://listserver.u2ug.org/ > >------- > >u2-users mailing list > >[EMAIL PROTECTED] > >To unsubscribe please visit http://listserver.u2ug.org/ > ------- > u2-users mailing list > [EMAIL PROTECTED] > To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/ ------- u2-users mailing list [EMAIL PROTECTED] To unsubscribe please visit http://listserver.u2ug.org/