RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-22 Thread Dennis Bartlett
 Just a quick look, it appears the code is adding to the
city and state

 totals before checking if the city or state values have
changed.

Allen, have you had this vision problem for long - quick
look, my apple!

 *test if city has changed?
  IF (CITY NE LAST.CITY) THEN GOSUB CITY.TOTALS

The final totals have to happen regardless because when the
list runs
out, the CITY _has_ changed... it's become null again (as it
were)
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-22 Thread Dennis Bartlett
 This code example is also flawed in that a break-on state
should
automatically
 break-on city first regardless if the city has changed. As
it is, it
assumes that
 there could never be this situation:

Agreed... knew there was summat I was missin' :0)
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-22 Thread Dennis Bartlett
 (A) Also, what do the CRT SPACE(40) lines do besides CRT?
 (B) And shouldn't this have been written using PRINT in
case
 the output wishes to go to the printer and you can use
 PRINTER ON instead of changing the CRT lines.

(A) The crt space(40) lines line up the totals under
the relevant columns!

(B) Agreed print could have been used (maybe even should
have)
BUT
the original request was to emulate a SORT statement that
didn't have a LPTR or (P on it... so I did exactly that!

(haven't you learnt yet to give the customer exactly what he
wants?)
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-22 Thread Mark Johnson
The CRT SPACE(40) should have the trailing colon. The PRINT statement has
universal appeal as it allows for an easy transition to the LPTR if that
request comes up later (it often does).

Regardless of the original design, I use PRINT exclusively for output and
reserve CRT for displaying screen messages during PRINTER ON or (P. I've
seen CRT ignored and a program littered with
PRINTER OFF
PRINT Something's Wrong
PRINTER On
which is easily replaced with CRT. The 2 character difference between CRT
and PRINT shouldn't justify its use as a wholesale replacement.
- Original Message -
From: Dennis Bartlett [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 22, 2004 2:26 AM
Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
example)


  (A) Also, what do the CRT SPACE(40) lines do besides CRT?
  (B) And shouldn't this have been written using PRINT in
 case
  the output wishes to go to the printer and you can use
  PRINTER ON instead of changing the CRT lines.

 (A) The crt space(40) lines line up the totals under
 the relevant columns!

 (B) Agreed print could have been used (maybe even should
 have)
 BUT
 the original request was to emulate a SORT statement that
 didn't have a LPTR or (P on it... so I did exactly that!

 (haven't you learnt yet to give the customer exactly what he
 wants?)
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-21 Thread Jan Shaw and Keith Johnson
I like the syntax a lot, and even put the LOOP on the same line as the
UNTIL.  So Ray Wurlod's example I would have written as

LOOP WHILE READSEQ line FROM f
   GOSUB processline
REPEAT


I was surprised to see an assertion that this didn't work in Pick, as I
remember Henry Eggers was a particularly keen exponent of the usage - which
implies that Reality should support it.


Regards, Keith Johnson

Owner/Host

www.emeraldglenlodge.co.nz
04 299 3066
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Mark Johnson
Thanks for this example. I was looking for a way to not test for the first
iteration every time. Another example illustrated it and kept it goto-less.

I can honestly say that in all my years of MV, no prior programmers or VARs
to my client's systems used LOOP-REPEAT for READNEXT and that virtually
every one was the
10  READNEXT ID ELSE GOTO 19
READ REC FROM F.FILE, ID ELSE GOTO 10
(process)
GOTO 10

scenario.

My Client's packages include Media Services Group, SHIMS, Results, Service
Automation Systems, Primac, GULL, Infoquest, IDS, DataMaster, Wizard, and a
whole slew of home-grown systems and they all use GOTO's in a logical sense
and yes, some in an illogical sense. But none are the GOTO-less environments
that everyone seems to harp upon.

I just wanted to see how it was done. You've answered all of my questions.

Thanks.
- Original Message -
From: Dennis Bartlett [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 21, 2004 5:07 AM
Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
example)


 SORT CUSTOMER
  BY STATE
  BY CITY
 {showing}   NAME
 BREAK-ONCITY
 BREAK-ONSTATE
 TOTAL   YTD-SALES


 ORDERS File layout
 --
 0Order Number
 1State
 2City
 3Cust.Name (for purpose of example)
 4Sales by month position (ie 12 multivals)


 PROGRAM YTD.SALES.RPT
 * author  :  d.bartlett
 * written :  21 June 04
 * example of GOTO-less code in a break-on environment
 * ---
 * Assumes there won't be a city in a different state
 * with the same name / code
 * ---
OPEN 'ORDERS' TO CUSTOMER ELSE STOP 201,'CUSTOMER'
TODAY = OCONV(DATE(),'D2/') ; * assumes dd/mm/yy
PERIOD = TODAY[4,2] ; * assumes simple periods
CUST.YTD.SALES = 0
LPT.WIDTH = 80
STATE.SALES = 0
CITY.SALES = 0
CUST.SALES = 0
TOT.SALES = 0
LAST.STATE = ''
LAST.CITY = ''

 * --
 *  select data - assumes I can still use select-by
 *  - if not, we do a two stage pass
 *(1) process file,
 *using locate to sequence state*city
 *build array1 = state*city } state*city*
 *build array2 = orderno
 *
 *(2) process sorted array1 with REMOVE
 *MORE = 1
 *LOOP
 *   REMOVE KEY FROM ARRAY1 SETTING MORE
 *   REMOVE ORDERNO FROM ARRAY2 SETTING JUNK
 *   * -- process
 *WHILE MORE
 *REPEAT
 *
 *  Limitations are size, speed
 * --
CMD = 'SELECT CUSTOMER'
CMD := ' BY STATE'
CMD := ' BY CITY'
CRT 'Selecting data - please wait'
EXECUTE CMD CAPTURING X RETURNING Y

IF (Y  1) THEN
   MSG = 'No records were found matching'
   MSG := ' your selection'
   CRT MSG :; INPUT REPLY
END ELSE
   CRT Y : ' records selected'
   GOSUB PROCESS.ORDERS
END
CRT @(-1)
STOP
 * =
 PROCESS.ORDERS:
LOOP
   READNEXT ORDERNO ELSE DONE = 1
UNTIL (DONE = 1)
   READ ORDREC FROM ORDERS, ORDERNO THEN
  GOSUB PARSE.ORDER
  GOSUB ACCUM.YTD

 *initialise temp variables
  IF (LAST.STATE = '') THEN
 LAST.STATE = STATE
 LAST.CITY = CITY
  END

 *test if city has changed?
  IF (CITY NE LAST.CITY) THEN GOSUB CITY.TOTALS

 *test if state has changed?
  IF (STATE NE LAST.STATE) THEN GOSUB STATE.TOTALS

 *print a detail line
  CRT NAME   'L#40' :
  CRT OCONV(YTD.SALES,  'MD2')   'R#15'
   END
REPEAT

 *  final CITY totals
GOSUB CITY.TOTALS
GOSUB STATE.TOTALS
GOSUB FINAL.TOTAL
RETURN
 * ---
 PARSE.ORDER:
 *  0Order Number
 *  1State
 *  2City
 *  3Cust.ID
 *  4Cust.Name (for purpose of example)
 *  5Sales by month position (ie 12 multivals)
STATE = ORDREC1
CITY  = ORDREC2
NAME  = ORDREC3
SALES = ORDREC4
RETURN
 * ---
 ACCUM.YTD:
CUST.SALES = 0
FOR P = 1 TO PERIOD
   CUST.SALES += OR.SALES1,P
NEXT P
STATE.SALES += CUST.SALES
CITY.SALES += CUST.SALES
TOT.SALES += CUST.SALES
RETURN
 * ---
 CITY.TOTALS:
CRT SPACE(40)  :
CRT STR('-',15)

CRT SPACE(40)  :
CRT OCONV(CITY.SALES, 'MD2') 'R#15'

LAST.CITY = CITY
CITY.SALES = 0
RETURN
 * ---
 STATE.TOTALS:
CRT

CRT SPACE(40)  :
CRT STR('=',15)

CRT SPACE(40)  :
CRT OCONV(STATE.SALES, 'MD2') 'R#15'

STATE.SALES = 0
LAST.STATE = STATE
RETURN

RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Allen E. Elwood \(CA\)
Just a quick look, it appears the code is adding to the city and state
totals before checking if the city or state values have changed.  This means
if the city or state has changed that it'll be adding some of the next city
and state totals to the previous city and state totals.  Unless I'm
mistaken, this will not match a uniquery stmt doing the same.  If you see my
example posted earlier you'll see it checks for change of key values, then
print totals, then clear totals, then add to totals, which is necessary for
correct results.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dennis Bartlett
Sent: Monday, June 21, 2004 2:07 AM
To: [EMAIL PROTECTED]
Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
example)


SORT CUSTOMER
 BY STATE
 BY CITY
{showing}   NAME
BREAK-ONCITY
BREAK-ONSTATE
TOTAL   YTD-SALES


ORDERS File layout
--
0Order Number
1State
2City
3Cust.Name (for purpose of example)
4Sales by month position (ie 12 multivals)


PROGRAM YTD.SALES.RPT
* author  :  d.bartlett
* written :  21 June 04
* example of GOTO-less code in a break-on environment
* ---
* Assumes there won't be a city in a different state
* with the same name / code
* ---
   OPEN 'ORDERS' TO CUSTOMER ELSE STOP 201,'CUSTOMER'
   TODAY = OCONV(DATE(),'D2/') ; * assumes dd/mm/yy
   PERIOD = TODAY[4,2] ; * assumes simple periods
   CUST.YTD.SALES = 0
   LPT.WIDTH = 80
   STATE.SALES = 0
   CITY.SALES = 0
   CUST.SALES = 0
   TOT.SALES = 0
   LAST.STATE = ''
   LAST.CITY = ''

* --
*  select data - assumes I can still use select-by
*  - if not, we do a two stage pass
*(1) process file,
*using locate to sequence state*city
*build array1 = state*city } state*city*
*build array2 = orderno
*
*(2) process sorted array1 with REMOVE
*MORE = 1
*LOOP
*   REMOVE KEY FROM ARRAY1 SETTING MORE
*   REMOVE ORDERNO FROM ARRAY2 SETTING JUNK
*   * -- process
*WHILE MORE
*REPEAT
*
*  Limitations are size, speed
* --
   CMD = 'SELECT CUSTOMER'
   CMD := ' BY STATE'
   CMD := ' BY CITY'
   CRT 'Selecting data - please wait'
   EXECUTE CMD CAPTURING X RETURNING Y

   IF (Y  1) THEN
  MSG = 'No records were found matching'
  MSG := ' your selection'
  CRT MSG :; INPUT REPLY
   END ELSE
  CRT Y : ' records selected'
  GOSUB PROCESS.ORDERS
   END
   CRT @(-1)
   STOP
* =
PROCESS.ORDERS:
   LOOP
  READNEXT ORDERNO ELSE DONE = 1
   UNTIL (DONE = 1)
  READ ORDREC FROM ORDERS, ORDERNO THEN
 GOSUB PARSE.ORDER
 GOSUB ACCUM.YTD

*initialise temp variables
 IF (LAST.STATE = '') THEN
LAST.STATE = STATE
LAST.CITY = CITY
 END

*test if city has changed?
 IF (CITY NE LAST.CITY) THEN GOSUB CITY.TOTALS

*test if state has changed?
 IF (STATE NE LAST.STATE) THEN GOSUB STATE.TOTALS

*print a detail line
 CRT NAME   'L#40' :
 CRT OCONV(YTD.SALES,  'MD2')   'R#15'
  END
   REPEAT

*  final CITY totals
   GOSUB CITY.TOTALS
   GOSUB STATE.TOTALS
   GOSUB FINAL.TOTAL
   RETURN
* ---
PARSE.ORDER:
*  0Order Number
*  1State
*  2City
*  3Cust.ID
*  4Cust.Name (for purpose of example)
*  5Sales by month position (ie 12 multivals)
   STATE = ORDREC1
   CITY  = ORDREC2
   NAME  = ORDREC3
   SALES = ORDREC4
   RETURN
* ---
ACCUM.YTD:
   CUST.SALES = 0
   FOR P = 1 TO PERIOD
  CUST.SALES += OR.SALES1,P
   NEXT P
   STATE.SALES += CUST.SALES
   CITY.SALES += CUST.SALES
   TOT.SALES += CUST.SALES
   RETURN
* ---
CITY.TOTALS:
   CRT SPACE(40)  :
   CRT STR('-',15)

   CRT SPACE(40)  :
   CRT OCONV(CITY.SALES, 'MD2') 'R#15'

   LAST.CITY = CITY
   CITY.SALES = 0
   RETURN
* ---
STATE.TOTALS:
   CRT

   CRT SPACE(40)  :
   CRT STR('=',15)

   CRT SPACE(40)  :
   CRT OCONV(STATE.SALES, 'MD2') 'R#15'

   STATE.SALES = 0
   LAST.STATE = STATE
   RETURN
* ---
FINAL.TOTAL:
   CRT

   CRT STR('=',LPT.WIDTH)
   CRT SPACE(40)  :

   CRT OCONV(TOT.SALES,'MD2')   'R#15'
   CRT STR('=',LPT.WIDTH)
   RETURN
* ---
END

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Mark Johnson
Sent: 18 June 2004 04:14
To: [EMAIL PROTECTED

Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Mark Johnson
Another note on the differences between READNEXTS.

As I support UD/UV/D3/MCD and Native clients, I like to be consistent in my
application programs. Thus, when appropriate, I have a subroutine that I can
use blindly in my application thinking and not have to remember which format
works for which flavor.

My routine is called GET.IDS(TCL, IDS) and basically takes the TCL
statement, either SSELECT, GET-LIST or null and throws the item-ids into the
variable IDS. Thus my application programs all have GET.IDS and the actual
program GET.IDS is flavorized.

SUBROUTINE GET.IDS(TCL, IDS)
***
* GATHER ITEM-IDS AND RETURN AS A VARIABLE
* MAJ 062104
***
FLAVOR=UD
IF TCL #  THEN
IF FLAVOR=MCD THEN
PERFORM TCL RTNLIST TCLLIST CAPTURING JUNK
END ELSE
EXECUTE TCL CAPTURING JUNK
END
END
IDS=
BEGIN CASE
CASE FLAVOR=UD OR FLAVOR=UV
LOOP WHILE READNEXT ID DO ; IDS-1=ID ; REPEAT
CASE FLAVOR=MCD
LOOP READNEXT ID FROM TCLLIST ELSE ID=EOF UNTIL ID=EOF DO ;
IDS-1=ID ; REPEAT
CASE FLAVOR=D3
LOOP READNEXT ID ELSE EXIT UNTIL 0 DO ; IDS-1=ID ; REPEAT
CASE 1
LOOP READNEXT ID ELSE ID=EOF UNTIL ID=EOF DO ; IDS-1=ID ;
REPEAT
CASE GOTO-friendly
10READNEXT ID THEN IDS-1=ID ; GOTO 10 ELSE NULL
END CASE
RETURN

If anyone chooses to use this routine, you can remove the unnecessary
flavors. This also works with a PROC-level or external active list. Just
pass the TCL as null.

You could also insert your own localized versions of converting an active
list to a variable. In any case, once i have this installed at a client's
system, all I really have to remember is CALL GET.IDS(TCL, IDS) and not have
to remember the different syntaxes.

Obviously for the CASE 1 and MCD flavor, insure that EOF isn't a valid ID in
the file being selected. Also, CASE 1 would work for all except MCD but the
intent is to optimize per flavor. I never really liked the requirement that
MCD required a listname if the list was gotten from a PERFORM. Also note
that none of these methods require the DONE=0/DONE=1 flag stuff.

my 1 cent.

p.s. I threw in the GOTO-friendly condition if anyone cares. And yes, i know
it will never be processed.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Mark Johnson
Sidebar to data/basic break-on totals:

I eliminate the chance of redundant or missed adding by rolling up totals
instead of details. What I mean is that within the LOOP READNEXT...REPEAT
detail processing, I accumulate those values to the closest subtotal, like
in this case, CITY. When I 'break-on' CITY, i roll the city totals to STATE
and clear the city totals when I reset the CITY value for the next break.
The last level, STATE, rolls up into a GRANDTOTAL variable during the
'break-on' STATE.

For grins, I also tend to have a common structure for the CITY.TOTAL,
STATE.TOTAL array and GRAND.TOTAL array as I can send these to a single
printline routine so that the formatting is consistent. Usually, I'm
accumulating more than one value (qty, price, cost etc) and having all the
formulas in one place is helpful. Also, I can fabricate a variable printline
like
LINE=TEXTL#10: :VAL1/100R2,#10: :VAL2/100R2,#10
PRINT LINE
and then accumulate the LINEs in a RECAP-1 variable for printing a summary
report at the end. Thus, after printing the regular GRAND.TOTAL line at the
end, I can announce a recap section and
LOOP UNTIL RECAP= DO ; PRINT RECAP1 ; DEL RECAP1 ; REPEAT

or your preferred method of printing an array.

This is great for creating a detailed A/R then summary A/R aging report
without processing twice.

my 1 cent.


This also semi-documents what levels roll up to which other levels
- Original Message -
From: Allen E. Elwood (CA) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 21, 2004 12:22 PM
Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
example)


 Just a quick look, it appears the code is adding to the city and state
 totals before checking if the city or state values have changed.  This
means
 if the city or state has changed that it'll be adding some of the next
city
 and state totals to the previous city and state totals.  Unless I'm
 mistaken, this will not match a uniquery stmt doing the same.  If you see
my
 example posted earlier you'll see it checks for change of key values, then
 print totals, then clear totals, then add to totals, which is necessary
for
 correct results.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Dennis Bartlett
 Sent: Monday, June 21, 2004 2:07 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
 example)


 SORT CUSTOMER
  BY STATE
  BY CITY
 {showing}   NAME
 BREAK-ONCITY
 BREAK-ONSTATE
 TOTAL   YTD-SALES


 ORDERS File layout
 --
 0Order Number
 1State
 2City
 3Cust.Name (for purpose of example)
 4Sales by month position (ie 12 multivals)


 PROGRAM YTD.SALES.RPT
 * author  :  d.bartlett
 * written :  21 June 04
 * example of GOTO-less code in a break-on environment
 * ---
 * Assumes there won't be a city in a different state
 * with the same name / code
 * ---
OPEN 'ORDERS' TO CUSTOMER ELSE STOP 201,'CUSTOMER'
TODAY = OCONV(DATE(),'D2/') ; * assumes dd/mm/yy
PERIOD = TODAY[4,2] ; * assumes simple periods
CUST.YTD.SALES = 0
LPT.WIDTH = 80
STATE.SALES = 0
CITY.SALES = 0
CUST.SALES = 0
TOT.SALES = 0
LAST.STATE = ''
LAST.CITY = ''

 * --
 *  select data - assumes I can still use select-by
 *  - if not, we do a two stage pass
 *(1) process file,
 *using locate to sequence state*city
 *build array1 = state*city } state*city*
 *build array2 = orderno
 *
 *(2) process sorted array1 with REMOVE
 *MORE = 1
 *LOOP
 *   REMOVE KEY FROM ARRAY1 SETTING MORE
 *   REMOVE ORDERNO FROM ARRAY2 SETTING JUNK
 *   * -- process
 *WHILE MORE
 *REPEAT
 *
 *  Limitations are size, speed
 * --
CMD = 'SELECT CUSTOMER'
CMD := ' BY STATE'
CMD := ' BY CITY'
CRT 'Selecting data - please wait'
EXECUTE CMD CAPTURING X RETURNING Y

IF (Y  1) THEN
   MSG = 'No records were found matching'
   MSG := ' your selection'
   CRT MSG :; INPUT REPLY
END ELSE
   CRT Y : ' records selected'
   GOSUB PROCESS.ORDERS
END
CRT @(-1)
STOP
 * =
 PROCESS.ORDERS:
LOOP
   READNEXT ORDERNO ELSE DONE = 1
UNTIL (DONE = 1)
   READ ORDREC FROM ORDERS, ORDERNO THEN
  GOSUB PARSE.ORDER
  GOSUB ACCUM.YTD

 *initialise temp variables
  IF (LAST.STATE = '') THEN
 LAST.STATE = STATE
 LAST.CITY = CITY
  END

 *test if city has changed?
  IF (CITY NE LAST.CITY) THEN GOSUB CITY.TOTALS

 *test if state has changed?
  IF (STATE NE LAST.STATE) THEN GOSUB STATE.TOTALS

 *print a detail line

Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Mark Johnson
This code example is also flawed in that a break-on state should
automatically break-on city first regardless if the city has changed. As it
is, it assumes that there could never be this situation:

CITYSTATE
MiddletownNJ
Springfield  NJ
Springfield  PA
Springfield  TX

Perhaps Cities and States won't have this real problem. But Salesman,
Customers and Products certainly could.

my 1 cent
- Original Message -
From: Allen E. Elwood (CA) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, June 21, 2004 12:22 PM
Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
example)


 Just a quick look, it appears the code is adding to the city and state
 totals before checking if the city or state values have changed.  This
means
 if the city or state has changed that it'll be adding some of the next
city
 and state totals to the previous city and state totals.  Unless I'm
 mistaken, this will not match a uniquery stmt doing the same.  If you see
my
 example posted earlier you'll see it checks for change of key values, then
 print totals, then clear totals, then add to totals, which is necessary
for
 correct results.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Dennis Bartlett
 Sent: Monday, June 21, 2004 2:07 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code
 example)


 SORT CUSTOMER
  BY STATE
  BY CITY
 {showing}   NAME
 BREAK-ONCITY
 BREAK-ONSTATE
 TOTAL   YTD-SALES


 ORDERS File layout
 --
 0Order Number
 1State
 2City
 3Cust.Name (for purpose of example)
 4Sales by month position (ie 12 multivals)


 PROGRAM YTD.SALES.RPT
 * author  :  d.bartlett
 * written :  21 June 04
 * example of GOTO-less code in a break-on environment
 * ---
 * Assumes there won't be a city in a different state
 * with the same name / code
 * ---
OPEN 'ORDERS' TO CUSTOMER ELSE STOP 201,'CUSTOMER'
TODAY = OCONV(DATE(),'D2/') ; * assumes dd/mm/yy
PERIOD = TODAY[4,2] ; * assumes simple periods
CUST.YTD.SALES = 0
LPT.WIDTH = 80
STATE.SALES = 0
CITY.SALES = 0
CUST.SALES = 0
TOT.SALES = 0
LAST.STATE = ''
LAST.CITY = ''

 * --
 *  select data - assumes I can still use select-by
 *  - if not, we do a two stage pass
 *(1) process file,
 *using locate to sequence state*city
 *build array1 = state*city } state*city*
 *build array2 = orderno
 *
 *(2) process sorted array1 with REMOVE
 *MORE = 1
 *LOOP
 *   REMOVE KEY FROM ARRAY1 SETTING MORE
 *   REMOVE ORDERNO FROM ARRAY2 SETTING JUNK
 *   * -- process
 *WHILE MORE
 *REPEAT
 *
 *  Limitations are size, speed
 * --
CMD = 'SELECT CUSTOMER'
CMD := ' BY STATE'
CMD := ' BY CITY'
CRT 'Selecting data - please wait'
EXECUTE CMD CAPTURING X RETURNING Y

IF (Y  1) THEN
   MSG = 'No records were found matching'
   MSG := ' your selection'
   CRT MSG :; INPUT REPLY
END ELSE
   CRT Y : ' records selected'
   GOSUB PROCESS.ORDERS
END
CRT @(-1)
STOP
 * =
 PROCESS.ORDERS:
LOOP
   READNEXT ORDERNO ELSE DONE = 1
UNTIL (DONE = 1)
   READ ORDREC FROM ORDERS, ORDERNO THEN
  GOSUB PARSE.ORDER
  GOSUB ACCUM.YTD

 *initialise temp variables
  IF (LAST.STATE = '') THEN
 LAST.STATE = STATE
 LAST.CITY = CITY
  END

 *test if city has changed?
  IF (CITY NE LAST.CITY) THEN GOSUB CITY.TOTALS

 *test if state has changed?
  IF (STATE NE LAST.STATE) THEN GOSUB STATE.TOTALS

 *print a detail line
  CRT NAME   'L#40' :
  CRT OCONV(YTD.SALES,  'MD2')   'R#15'
   END
REPEAT

 *  final CITY totals
GOSUB CITY.TOTALS
GOSUB STATE.TOTALS
GOSUB FINAL.TOTAL
RETURN
 * ---
 PARSE.ORDER:
 *  0Order Number
 *  1State
 *  2City
 *  3Cust.ID
 *  4Cust.Name (for purpose of example)
 *  5Sales by month position (ie 12 multivals)
STATE = ORDREC1
CITY  = ORDREC2
NAME  = ORDREC3
SALES = ORDREC4
RETURN
 * ---
 ACCUM.YTD:
CUST.SALES = 0
FOR P = 1 TO PERIOD
   CUST.SALES += OR.SALES1,P
NEXT P
STATE.SALES += CUST.SALES
CITY.SALES += CUST.SALES
TOT.SALES += CUST.SALES
RETURN
 * ---
 CITY.TOTALS:
CRT SPACE(40)  :
CRT STR('-',15)

CRT SPACE(40)  :
CRT OCONV

Re: [U2] [UV] WHILE READNEXT id DO {{not a holy war,just a code example)

2004-06-21 Thread Dave S
That's painful to look at.
 
Isn't it more efficient to do the select and then read the id's while they are in 
memory ?
 
What if your selection contains 500,000 items, won't that IDS array be huge ?
 

Mark Johnson [EMAIL PROTECTED] wrote:
Another note on the differences between READNEXTS.

As I support UD/UV/D3/MCD and Native clients, I like to be consistent in my
application programs. Thus, when appropriate, I have a subroutine that I can
use blindly in my application thinking and not have to remember which format
works for which flavor.

My routine is called GET.IDS(TCL, IDS) and basically takes the TCL
statement, either SSELECT, GET-LIST or null and throws the item-ids into the
variable IDS. Thus my application programs all have GET.IDS and the actual
program GET.IDS is flavorized.

SUBROUTINE GET.IDS(TCL, IDS)
***
* GATHER ITEM-IDS AND RETURN AS A VARIABLE
* MAJ 062104
***
FLAVOR=UD
IF TCL #  THEN
IF FLAVOR=MCD THEN
PERFORM TCL RTNLIST TCLLIST CAPTURING JUNK
END ELSE
EXECUTE TCL CAPTURING JUNK
END
END
IDS=
BEGIN CASE
CASE FLAVOR=UD OR FLAVOR=UV
LOOP WHILE READNEXT ID DO ; IDS-1=ID ; REPEAT
CASE FLAVOR=MCD
LOOP READNEXT ID FROM TCLLIST ELSE ID=EOF UNTIL ID=EOF DO ;
IDS-1=ID ; REPEAT
CASE FLAVOR=D3
LOOP READNEXT ID ELSE EXIT UNTIL 0 DO ; IDS-1=ID ; REPEAT
CASE 1
LOOP READNEXT ID ELSE ID=EOF UNTIL ID=EOF DO ; IDS-1=ID ;
REPEAT
CASE GOTO-friendly
10 READNEXT ID THEN IDS-1=ID ; GOTO 10 ELSE NULL
END CASE
RETURN

If anyone chooses to use this routine, you can remove the unnecessary
flavors. This also works with a PROC-level or external active list. Just
pass the TCL as null.

You could also insert your own localized versions of converting an active
list to a variable. In any case, once i have this installed at a client's
system, all I really have to remember is CALL GET.IDS(TCL, IDS) and not have
to remember the different syntaxes.

Obviously for the CASE 1 and MCD flavor, insure that EOF isn't a valid ID in
the file being selected. Also, CASE 1 would work for all except MCD but the
intent is to optimize per flavor. I never really liked the requirement that
MCD required a listname if the list was gotten from a PERFORM. Also note
that none of these methods require the DONE=0/DONE=1 flag stuff.

my 1 cent.

p.s. I threw in the GOTO-friendly condition if anyone cares. And yes, i know
it will never be processed.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-20 Thread Anthony W. Youngman
In message [EMAIL PROTECTED], [EMAIL PROTECTED] writes
At any rate Mark, I have never seen a problem using GOTOs that I couldn't
re-create without using GOTOs.  But I think what you're really after is someone
to do this work FOR you.  So show me the purchase order first ...
I have. But that was because the customer's spec spec'd a jump from one 
structure into the middle of another.

An absolutely dire requirement to code. But that was what they wanted, 
and refactoring the spec would have been a nasty job. So I coded as per 
spec, safe in the knowledge that if it blew up I could just say sorry, 
but that's what you asked for :-)

Cheers,
Wol
--
Anthony W. Youngman [EMAIL PROTECTED]
'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the
thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The man
lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998
Visit the MaVerick web-site - http://www.maverick-dbms.org Open Source Pick
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Mats Carlid
I presume you have never had to  maintain programs written in
a language totally lacking  structured code elements like assembler
or to a lesser degree fortranIV.
I have.
Believe me:
GOTO's   ( or conditional and unconditional branches, jumps or transfers 
)   ARE EVIL !

It's som much easier to follow a program with  FOR , IF ... ELSE
LOOP and CASE .
To untangle assembler programs I  marked the loops  and jumps  with long 
arrows
on the printed programs  - so much work just to get the  overall picture
that's  emediatelly apparent in structured code!

IMNSHO  however  we shall not abandon the GOTO  before we have
some  exception handling  mechanism -  like   try / catch  in java.
Just don't use them when the 'structured'  alternative exists.
--  mats
PS. 
   The lack of indentation i assembler  and the short names (6char) and
   numeric labels in fortranIV contributed to the unredability  too.

Mark Johnson wrote:
I'd love to see this test. What's the hatred with the GOTO's. If they're so
bad, then let's vote to remove them from the compiler. Let's remove RETURN
TO and CLEAR while we're at it as well.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Dennis Bartlett
My first job was in Fortran. I understand why GOTO's are
evil.

That said, I can see where someone in that frenzy of getting
an idea
down, and not having time to return and tidy one's code, can
end up
(only too soon) with an un-manageable system.

Long-time maintenance programmers have things they don't
like - like
GOTO - that they've sweated through. Newbies, or slow
learners, don't
realise the legacy one leaves when writing in a sloppy way.

Primary Concept
* Not using GOTO's forces me to think out the structure
before starting.

Rules of Coding
* Code remains in its state until completely re-written (ie
you start it
bad, its gonna stay bad).
* Not using GOTO's forces me to think out the structure
before starting.
* Just coz YOU program that way doesn't mean the guy after
you will be
able to (ie be considerate - you're bound to move on
sometime, and
someone else gets your garbage)
* think big. If you plan it to take just about anything,
within reason,
and then program it with a wide vision, efficient will it be
(and happy
management  users will follow)
* use comments - that way there's no misunderstanding of
intent
* take pride in what you do - after all, this is what you're
leaving the
next generation - is that what you want to be remembered
for?

dennis
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Mats Carlid
Sent: 18 June 2004 09:43
To: [EMAIL PROTECTED]
Subject: Re: [U2] [UV] WHILE READNEXT id DO


 I presume you have never had to  maintain programs written
in a
language totally lacking  structured code elements like
assembler or to
a lesser degree fortranIV.

I have.

Believe me:
GOTO's   ( or conditional and unconditional branches, jumps
or transfers

)   ARE EVIL !

It's som much easier to follow a program with  FOR , IF ...
ELSE LOOP
and CASE .

To untangle assembler programs I  marked the loops  and
jumps  with long

arrows
on the printed programs  - so much work just to get the
overall picture
that's  emediatelly apparent in structured code!

IMNSHO  however  we shall not abandon the GOTO  before we
have
some  exception handling  mechanism -  like   try / catch
in java.
Just don't use them when the 'structured'  alternative
exists.


--  mats


PS.
The lack of indentation i assembler  and the short names
(6char) and
numeric labels in fortranIV contributed to the
unredability  too.


Mark Johnson wrote:

I'd love to see this test. What's the hatred with the
GOTO's. If
they're so bad, then let's vote to remove them from the
compiler. Let's

remove RETURN TO and CLEAR while we're at it as well.
---
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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread BNeylon
My fault, I should have mentioned the times were from the second run.  And 
when I switched the order the corresponding times also were the same.
I'll try your code when I get a chance.
Thanks
Bruce

Bruce M Neylon
Health Care Management Group 





Mark Johnson [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
06/17/2004 08:02 PM
Please respond to u2-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [U2] [UV] WHILE READNEXT id DO

Don't forget that the second set has the benefit of the first set leaving
some of the data in virtual memory, hence the second set would have been
longer.

my 1 cent

How about this on your similar UD system. Correct typing implied.

OPEN MASTER ELSE STOP
SELECT MASTER
START=SYS9
10 READNEXT ID ELSE GOTO 15
GOTO 10
15 END=SYS9
PRINT END-START
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread alfkec
This is what I got on UD 5.1.27 Win2K Dell Poweredge 2500 933Mhz server:
Ran one after the other, only user on the system.
TIME.READNEXT  
46  8712  READNEXT ELSE EXIT   
32  8712  WHILE 1  
32  8712  LOOP WHILE READNEXT ID DO
30  8712  GOTO 
:.X
TIME.READNEXT  
32  8712  READNEXT ELSE EXIT   
46  8712  WHILE 1  
31  8712  LOOP WHILE READNEXT ID DO
32  8712  GOTO 
:.X
TIME.READNEXT  
31  8712  READNEXT ELSE EXIT   
32  8712  WHILE 1  
31  8712  LOOP WHILE READNEXT ID DO
46  8712  GOTO 
:.X
TIME.READNEXT  
47  8712  READNEXT ELSE EXIT   
32  8712  WHILE 1  
31  8712  LOOP WHILE READNEXT ID DO
31  8712  GOTO 

Here is the code I ran - pretty much a cut-n-paste from the e-mails, I just
added the counter to give it something to do. Although it took me a minute
to figure out where to put it amid the GOTO's :).

OPEN 'TEST.FILE' TO TEST.FILE ELSE STOP
SELECT TEST.FILE
CTR = 0
START.CPU = SYSTEM(9)
LOOP
READNEXT ID ELSE EXIT
CTR += 1
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU:  :CTR:  READNEXT ELSE EXIT
CTR = 0
SELECT TEST.FILE
START.CPU = SYSTEM(9)
LOOP
WHILE 1 DO
READNEXT ID ELSE EXIT
CTR += 1
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU:  :CTR:  WHILE 1
CTR = 0
SELECT TEST.FILE
START.CPU = SYSTEM(9)
LOOP WHILE READNEXT ID DO
CTR += 1
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU:  :CTR:  LOOP WHILE READNEXT ID DO
CTR = 0
SELECT TEST.FILE
START.CPU = SYSTEM(9)
10 READNEXT ID ELSE GOTO 15
CTR += 1
GOTO 10
15 END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU:  :CTR:  GOTO


-Original Message-
From: Mark Johnson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 6:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [U2] [UV] WHILE READNEXT id DO


Don't forget that the second set has the benefit of the first 
set leaving
some of the data in virtual memory, hence the second set would 
have been
longer.

my 1 cent

How about this on your similar UD system. Correct typing implied.

OPEN MASTER ELSE STOP
SELECT MASTER
START=SYS9
10 READNEXT ID ELSE GOTO 15
GOTO 10
15 END=SYS9
PRINT END-START
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Mark Johnson
I respond with the GOTO perspective when it's cast in an absolutely negative
light as in My teacher failed us or Our Company will fire you if you use
a GOTO kind of limited thinking. I stand by my beer/alcoholic analogy.

And actually, I would like to see this break-on situation done without
GOTO's. I've developed a routine that's nice and tidy for any number of
break-on levels and I'd like to learn a different way.

One can learn programming from a variety of sources: Academic, other peoples
code and system-level examples (DM,BP,). I've not run into these GOTO-less
environments everyone talks about in 25 years of perhaps 40 different
application systems. And yes, I've certainly seen enought bad use of GOTO's
to recognize its potential danger. But not in an absolute sense.

Thanks.
- Original Message -
From: Ken Wallis [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 9:32 PM
Subject: RE: [U2] [UV] WHILE READNEXT id DO


 Mark Johnson wrote:

  This appears to be the semi-annual GOTO holy war.

 But only one side is fighting.

 Leave it alone Mark.  Nothing good came of it last time, and nothing good
 will come of it this time.  Those who believe GOTOs have their uses will
not
 be convinced otherwise by a thread on a mailing list like this, and those
of
 us who avoid GOTOs completely will similarly not change their mindset for
 you.

  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.

 Not that I intend to take this further Mark, but are you seriously trying
to
 imply that sorting, breakpointing and totalling cannot be done well
without
 using GOTO?

 Although I have trouble envisioning it, I'm confident that there is a
coding
 solution to this specific problem that makes use of GOTO, and I'm sure
that
 you have such a solution in mind.  Great.  If that makes you productive
and
 you clients happy, then I'm all for it.  Just so long as I don't have to
 consult at one of your client sites once you've retired.  My mind simply
 doesn't work that way.  I tend to think about iteration before I look at
 branches.  That drives me towards nested LOOPs and all sorts of structures
 in which GOTOs are, to my mind, both superfluous and dangerous.

 I don't want to get into this Holy War.  Time was when I'd have taken up
the
 cudgel, but it doesn't achieve anything when you are more than an arm's
 length away!  I'd rather disagree without becoming disagreeable.  Please
 simply take it as read that any problem that can be solved in BASIC using
a
 GOTO, can also be solved without using it.  Similarly, I assume that
 anything I can code a solution to has at least one equivalent solution
that
 involves a GOTO statement.

 Cheers,

 Ken
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Glenn Herbert
At 01:07 PM 6/18/2004, you wrote:
I've always thought it would be cool if some Pick vendor would create a verb
like MAKE.BASIC
And you could say
MAKE.BASIC SELECT CUSTOMER WITH LAST.NAME = JOHNSON BY STATE BREAK-ON STATE
TOTAL COUNTER
And it would take the statement and turn it into a BASIC program (not just
using EXECUTE you slackers).  That way for particularly thorny problems, you
could have a template that you then modified to do something unusual that you
couldn't figure out how to do in straight query language.
Funny you say this.   Ever heard of the ancient utility called REPORT-GEN 
by Interactive Systems in Phoenix?  I'm not sure if that place is still in 
business, but I actually have source code from this utility that does 
exactly as you stated; you start the utility, enter all the portions of 
your statement and when done, it generates nifty BASIC code, albeit circa 1984.

Some may not like this code, as its a fine example of how NOT to use 
GOTO's!  Here's a snippet from within the code (total of 674 lines of this!!):

PRINT CMSG:DO YOU WANT TO HDR-SUPP? (Y OR N): :
INPUT HDRSUPP
IF HDRSUPP = ? THEN GOTO 100620
IF HDRSUPP = ^ THEN GOTO 610
IF HDRSUPP = ^^ THEN GOTO 10
IF HDRSUPP # Y AND HDRSUPP # N THEN GOTO 620
GOSUB 8000
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Jefferson, Jim
And ol' Arev has this feature as a query option:

LIST FILE BY THIS BY THAT BREAK-ON THIS TOTAL SOMETHING (X)

With the option X, you are prompted for a file name and record id, and the source 
code is written there.  Sort of funky-looking, though...  Don't know if they carried 
it over into OpenInsight.

Jim


At 01:07 PM 6/18/2004, you wrote:
I've always thought it would be cool if some Pick vendor would create a verb
like MAKE.BASIC

Funny you say this.   Ever heard of the ancient utility called REPORT-GEN 
by Interactive Systems in Phoenix?  I'm not sure if that place is still in 
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-18 Thread Ray Wurlod
Personally, I love this syntax.  When training others, I usually explain it in this 
form; READNEXT has to generate a true/untrue value of some kind to determine whether 
to go down its THEN or ELSE path.  We take advantage of that Boolean context to 
trigger the behaviour of WHERE or UNTIL in a looping context.

READNEXT is not the only statement that exhibits this behaviour.  Almost any statement 
that has THEN/ELSE can use it.  But READNEXT, READSEQ/READBLK are the most sensible. 
For example, to process an entire input file:
LOOP
WHILE READSEQ line FROM f
   GOSUB processline
REPEAT

I don't find it difficult to read; FORMAT indents it correctly (which suggests that 
it's legal syntax).  

It would be nice were there a section in the BASIC manual about the Boolean context of 
certain statements, but that's only a minor complaint.  Of course, each statement 
syntax that appears to make at least one of THEN or ELSE mandatory would need a note 
referring to this section.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Adrian . Womack
LOOP
code
WHILE READNEXT id DO
more code
REPEAT

This format of the READNEXT statement is used in a couple of places in the
UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.

If I look up READNEXT in the manual (or in HELP from TCL) - there is no
mention of this format of the statement.

And in the manual the THEN and ELSE are enclosed in braces: {THEN statements
[ELSE statements] | ELSE statements}
which according to convention means that I have to choose one non-optional
item.

Has this format of the statement just been left out of the manual by mistake
or is it a new format, that was never documented.

And, what are people's thoughts on using this format. Personally I dislike
it, as it isn't easily readable, it's not documented and it's not a standard
use of the statement syntax.

AdrianW




Disclaimer.  This e-mail is private and confidential. If you are not the
intended recipient, please advise us by return e-mail immediately, and
delete the e-mail and any attachments without using or disclosing the
contents in any way. The views expressed in this e-mail are those of the
author, and do not represent those of this company unless this is clearly
indicated. You should scan this e-mail and any attachments for viruses. This
company accepts no liability for any direct or indirect damage or loss
resulting from the use of any attachments to this e-mail.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Piers Angliss
Personally I use it all the time (except I'm even sloppier and I drop the
DO )
It's been around for as long as I can remember so I think it just isn't
documented
I find it pretty readable but I take your point on using undocumented
features - boy, will I be in trouble if IBM ever change it.

Piers



LOOP
code
WHILE READNEXT id DO
more code
REPEAT


And, what are people's thoughts on using this format. Personally I dislike
it, as it isn't easily readable, it's not documented and it's not a standard
use of the statement syntax.

AdrianW
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Louis Windsor
The format -

LOOP WHILE READNEXT ID
code
REPEAT

was the suggested standard where I used to work.

Louis


- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 4:57 PM
Subject: [U2] [UV] WHILE READNEXT id DO


: LOOP
: code
: WHILE READNEXT id DO
: more code
: REPEAT
:
: This format of the READNEXT statement is used in a couple of places in the
: UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.
:
: If I look up READNEXT in the manual (or in HELP from TCL) - there is no
: mention of this format of the statement.
:
: And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
: [ELSE statements] | ELSE statements}
: which according to convention means that I have to choose one
non-optional
: item.
:
: Has this format of the statement just been left out of the manual by
mistake
: or is it a new format, that was never documented.
:
: And, what are people's thoughts on using this format. Personally I dislike
: it, as it isn't easily readable, it's not documented and it's not a
standard
: use of the statement syntax.
:
: AdrianW
:
:
:
:
: Disclaimer.  This e-mail is private and confidential. If you are not the
: intended recipient, please advise us by return e-mail immediately, and
: delete the e-mail and any attachments without using or disclosing the
: contents in any way. The views expressed in this e-mail are those of the
: author, and do not represent those of this company unless this is clearly
: indicated. You should scan this e-mail and any attachments for viruses.
This
: company accepts no liability for any direct or indirect damage or loss
: resulting from the use of any attachments to this e-mail.
: ---
: 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Louie Gouws
Hi Adrian,

I personally use:

EOF=0
LOOP
   READNEXT id ELSE EOF=1
   code
UNTIL EOF DO
   code
REPEAT

It is much clearer(i hope) to the next guy looking at the code.

Louie.


Adrian wrote:

LOOP
   code
WHILE READNEXT id DO
   more code
REPEAT

This format of the READNEXT statement is used in a couple of places in the
UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.

If I look up READNEXT in the manual (or in HELP from TCL) - there is no
mention of this format of the statement.

And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
[ELSE statements] | ELSE statements}
which according to convention means that I have to choose one
non-optional
item.

Has this format of the statement just been left out of the manual by
mistake
or is it a new format, that was never documented.

And, what are people's thoughts on using this format. Personally I dislike
it, as it isn't easily readable, it's not documented and it's not a
standard
use of the statement syntax.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Mark Johnson
For any of the newbies on this forum, there are a few things to mention
about READNEXT.

First, it is not married to or dependent upon LOOP...REPEAT. That's just one
of the popular ways it's used. I've seen and used it in different
structures.

Second, the dynamics of WHILE/UNTIL behave differently on U2 versus other
versions of MV. For example, LOOP WHILE READNEXT ID DO doesn't work on D3 or
other native systems. In those cases it needs the ELSE somewhere.

Third, you can have multiple READNEXT statements against the same active
list (numbered/referenced or not). It's not that advised but it's not wrong
either if used with prudence.

Fourth, the READNEXT ID,MV systax is available if the active list used
BY-EXP and you need the MV reference.

READNEXT is a very popular command for its obvious purpose. I wish we had
MOVEFIRST, MOVELAST or READPREVIOUS but we can accomplish these tasks using
traditional MV variables and pointers.

My 1 cent.


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 4:57 AM
Subject: [U2] [UV] WHILE READNEXT id DO


 LOOP
 code
 WHILE READNEXT id DO
 more code
 REPEAT

 This format of the READNEXT statement is used in a couple of places in the
 UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.

 If I look up READNEXT in the manual (or in HELP from TCL) - there is no
 mention of this format of the statement.

 And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
 [ELSE statements] | ELSE statements}
 which according to convention means that I have to choose one
non-optional
 item.

 Has this format of the statement just been left out of the manual by
mistake
 or is it a new format, that was never documented.

 And, what are people's thoughts on using this format. Personally I dislike
 it, as it isn't easily readable, it's not documented and it's not a
standard
 use of the statement syntax.

 AdrianW




 Disclaimer.  This e-mail is private and confidential. If you are not the
 intended recipient, please advise us by return e-mail immediately, and
 delete the e-mail and any attachments without using or disclosing the
 contents in any way. The views expressed in this e-mail are those of the
 author, and do not represent those of this company unless this is clearly
 indicated. You should scan this e-mail and any attachments for viruses.
This
 company accepts no liability for any direct or indirect damage or loss
 resulting from the use of any attachments to this e-mail.
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Mark Johnson
READNEXT is a statement that lends itself to many expressions of its use.
IBM could only document its standard use and not all the possible
combinations if burying it inside of LOOPs etc.

This statement has many 'standards' and usually the house standard prevails
as it should be consistent within the application.

my 1 cent

- Original Message -
From: Louie Gouws [EMAIL PROTECTED]
To: u2 List (E-mail) [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 6:50 AM
Subject: Re: [U2] [UV] WHILE READNEXT id DO


 Hi Adrian,

 I personally use:

 EOF=0
 LOOP
READNEXT id ELSE EOF=1
code
 UNTIL EOF DO
code
 REPEAT

 It is much clearer(i hope) to the next guy looking at the code.

 Louie.


 Adrian wrote:
 
 LOOP
  code
 WHILE READNEXT id DO
  more code
 REPEAT
 
 This format of the READNEXT statement is used in a couple of places in
the
 UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.
 
 If I look up READNEXT in the manual (or in HELP from TCL) - there is no
 mention of this format of the statement.
 
 And in the manual the THEN and ELSE are enclosed in braces: {THEN
 statements
 [ELSE statements] | ELSE statements}
 which according to convention means that I have to choose one
 non-optional
 item.

 Has this format of the statement just been left out of the manual by
 mistake
 or is it a new format, that was never documented.
 
 And, what are people's thoughts on using this format. Personally I
dislike
 it, as it isn't easily readable, it's not documented and it's not a
 standard
 use of the statement syntax.
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Dave S
I like to use :
 
LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT


Louis Windsor [EMAIL PROTECTED] wrote:
The format -

LOOP WHILE READNEXT ID
code
REPEAT

was the suggested standard where I used to work.

Louis


- Original Message - 
From: 
To: 
Sent: Thursday, June 17, 2004 4:57 PM
Subject: [U2] [UV] WHILE READNEXT id DO


: LOOP
: code
: WHILE READNEXT id DO
: more code
: REPEAT
:
: This format of the READNEXT statement is used in a couple of places in the
: UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.
:
: If I look up READNEXT in the manual (or in HELP from TCL) - there is no
: mention of this format of the statement.
:
: And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
: [ELSE statements] | ELSE statements}
: which according to convention means that I have to choose one
non-optional
: item.
:
: Has this format of the statement just been left out of the manual by
mistake
: or is it a new format, that was never documented.
:
: And, what are people's thoughts on using this format. Personally I dislike
: it, as it isn't easily readable, it's not documented and it's not a
standard
: use of the statement syntax.
:
: AdrianW
:
:
:
:
: Disclaimer. This e-mail is private and confidential. If you are not the
: intended recipient, please advise us by return e-mail immediately, and
: delete the e-mail and any attachments without using or disclosing the
: contents in any way. The views expressed in this e-mail are those of the
: author, and do not represent those of this company unless this is clearly
: indicated. You should scan this e-mail and any attachments for viruses.
This
: company accepts no liability for any direct or indirect damage or loss
: resulting from the use of any attachments to this e-mail.
: ---
: 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/


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Dave S
Someone required all coders to code that way.

Kishor Parmar [EMAIL PROTECTED] wrote:Why do you need the WHILE 1 DO?
You could use
LOOP
READNEXT ID ELSE EXIT
code

REPEAT

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave S
Sent: 17 June 2004 14:57
To: [EMAIL PROTECTED]
Subject: Re: [U2] [UV] WHILE READNEXT id DO

I like to use :

LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT


Louis Windsor wrote:
The format -

LOOP WHILE READNEXT ID
code
REPEAT

was the suggested standard where I used to work.

Louis


- Original Message - 
From: 
To: 
Sent: Thursday, June 17, 2004 4:57 PM
Subject: [U2] [UV] WHILE READNEXT id DO


: LOOP
: code
: WHILE READNEXT id DO
: more code
: REPEAT
:
: This format of the READNEXT statement is used in a couple of places in
the
: UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.
:
: If I look up READNEXT in the manual (or in HELP from TCL) - there is
no
: mention of this format of the statement.
:
: And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
: [ELSE statements] | ELSE statements}
: which according to convention means that I have to choose one
non-optional
: item.
:
: Has this format of the statement just been left out of the manual by
mistake
: or is it a new format, that was never documented.
:
: And, what are people's thoughts on using this format. Personally I
dislike
: it, as it isn't easily readable, it's not documented and it's not a
standard
: use of the statement syntax.
:
: AdrianW
:
:
:
:
: Disclaimer. This e-mail is private and confidential. If you are not
the
: intended recipient, please advise us by return e-mail immediately, and
: delete the e-mail and any attachments without using or disclosing the
: contents in any way. The views expressed in this e-mail are those of
the
: author, and do not represent those of this company unless this is
clearly
: indicated. You should scan this e-mail and any attachments for
viruses.
This
: company accepts no liability for any direct or indirect damage or loss
: resulting from the use of any attachments to this e-mail.
: ---
: 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/


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Internet Email Confidentiality: Privileged/Confidential Information may be contained 
in this message. If you are not the addressee indicated in this message (or 
responsible for delivery of the message to such person), you may not copy or deliver 
this message to anyone. In such case, you should destroy this message and kindly 
notify the sender by reply email. Please advise immediately if you or your employer do 
not consent to Internet email for messages of this kind. Opinions, conclusions and 
other information in this message that do not relate to the official business of my 
firm shall be understood as neither given nor endorsed by it. Should you wish to 
communicate with us by e-mail, we cannot guarantee the security of any data outside 
our own computer systems. Please note that voice calls to Call Stream may be recorded 
or monitored.
17/6/2004
Kishor Parmar
[EMAIL PROTECTED]
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/



-
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Peter Gonzalez
That is what I have used for years.  It's simple to understand what the 
program is doing.


At 03:03 PM 6/17/2004 +0100, you wrote:
Why do you need the WHILE 1 DO?
You could use
LOOP
 READNEXT ID ELSE EXIT
 code

REPEAT



Peter Gonzalez
Senior Programmer Analyst
M  M Aerospace Hardware, Inc., a B/E Aerospace Company
1 NW 15 Terrace
Miami, Florida 33172
Phone: 305.925.2714
Fax: 305.925.2610
www.mmaero.com
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread BNeylon
Why use the WHILE 1 DO?  Why not
LOOP
READNEXT ID ELSE EXIT
REPEAT
Doesn't the WHILE 1 DO cost?  not that it would cost much. :-)

Bruce M Neylon
Health Care Management Group 





Dave S [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
06/17/2004 09:56 AM
Please respond to u2-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [U2] [UV] WHILE READNEXT id DO

I like to use :
 
LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Nick Cipollina
You could even try

LOOP
READNEXT ID ELSE EXIT
[Code goes here]

REPEAT

This works just fine.

-Original Message-
From: Dave S [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 17, 2004 9:57 AM
To: [EMAIL PROTECTED]
Subject: Re: [U2] [UV] WHILE READNEXT id DO

I like to use :
 
LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT


Louis Windsor [EMAIL PROTECTED] wrote:
The format -

LOOP WHILE READNEXT ID
code
REPEAT

was the suggested standard where I used to work.

Louis


- Original Message - 
From: 
To: 
Sent: Thursday, June 17, 2004 4:57 PM
Subject: [U2] [UV] WHILE READNEXT id DO


: LOOP
: code
: WHILE READNEXT id DO
: more code
: REPEAT
:
: This format of the READNEXT statement is used in a couple of places in the
: UniVerse BASIC manual. It looks like READNEXT is returning a Boolean.
:
: If I look up READNEXT in the manual (or in HELP from TCL) - there is no
: mention of this format of the statement.
:
: And in the manual the THEN and ELSE are enclosed in braces: {THEN
statements
: [ELSE statements] | ELSE statements}
: which according to convention means that I have to choose one
non-optional
: item.
:
: Has this format of the statement just been left out of the manual by
mistake
: or is it a new format, that was never documented.
:
: And, what are people's thoughts on using this format. Personally I dislike
: it, as it isn't easily readable, it's not documented and it's not a
standard
: use of the statement syntax.
:
: AdrianW
:
:
:
:
: Disclaimer. This e-mail is private and confidential. If you are not the
: intended recipient, please advise us by return e-mail immediately, and
: delete the e-mail and any attachments without using or disclosing the
: contents in any way. The views expressed in this e-mail are those of the
: author, and do not represent those of this company unless this is clearly
: indicated. You should scan this e-mail and any attachments for viruses.
This
: company accepts no liability for any direct or indirect damage or loss
: resulting from the use of any attachments to this e-mail.
: ---
: 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/


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


NOTICE OF CONFIDENTIALITY: The information contained in this transmission,
and in any accompanying documents, constitutes confidential information
belonging to Heritage Information Systems, Inc.  This information is
intended only for the use of the individual or entity named above.  If you
are not the intended recipient of this transmission, you are hereby notified
that any disclosure, copying, distribution, or the taking of any action in
reliance of this information, is strictly prohibited.  If you have received
this message in error, please immediately notify us by telephone, at
804-644-8707 to arrange for its proper destruction.  Thank you.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Dave S
If you are running on some old school system, it may cost you.
 
But don't these programs on Unidata all get compiled into C ?

[EMAIL PROTECTED] wrote:
Why use the WHILE 1 DO? Why not
LOOP
READNEXT ID ELSE EXIT
REPEAT
Doesn't the WHILE 1 DO cost? not that it would cost much. :-)

Bruce M Neylon
Health Care Management Group 





Dave S 
Sent by: [EMAIL PROTECTED]
06/17/2004 09:56 AM
Please respond to u2-users


To: [EMAIL PROTECTED]
cc: 
Subject: Re: [U2] [UV] WHILE READNEXT id DO

I like to use :

LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


-
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Simon Lewington
[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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread BNeylon
If you are running on any system it will cost you.  The only question is, 
do you mind paying the price?  Little things do add up. 
If you are on UniData run this. Plug in your own huge file.
OPEN 'MASTER' TO MASTER ELSE STOP
SELECT MASTER
START.CPU = SYSTEM(9)
LOOP
READNEXT ID ELSE EXIT
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU
SELECT MASTER
START.CPU = SYSTEM(9)
LOOP
WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU

I get 
290
320


Bruce M Neylon
Health Care Management Group 





Dave S [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
06/17/2004 01:09 PM
Please respond to u2-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [U2] [UV] WHILE READNEXT id DO

If you are running on some old school system, it may cost you.
 
But don't these programs on Unidata all get compiled into C ?

[EMAIL PROTECTED] wrote:
Why use the WHILE 1 DO? Why not
LOOP
READNEXT ID ELSE EXIT
REPEAT
Doesn't the WHILE 1 DO cost? not that it would cost much. :-)

Bruce M Neylon
Health Care Management Group 





Dave S 
Sent by: [EMAIL PROTECTED]
06/17/2004 09:56 AM
Please respond to u2-users


To: [EMAIL PROTECTED]
cc: 
Subject: Re: [U2] [UV] WHILE READNEXT id DO

I like to use :

LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

 
-
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
---
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/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Allen E. Elwood \(CA\)
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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Peter Gonzalez
Now we all know that you are kidding, right?

Rule number 1 when we traine new programmers. NO GOTOs!

At 07:02 PM 6/17/2004 +0100, you wrote:
[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/



Peter Gonzalez
Senior Programmer Analyst
M  M Aerospace Hardware, Inc., a B/E Aerospace Company
1 NW 15 Terrace
Miami, Florida 33172
Phone: 305.925.2714
Fax: 305.925.2610
www.mmaero.com
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Glenn Herbert
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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Dave S
No thanks. I don't have any time for that today or tomorrow either.
 
We are running SB+ here and don't write this little loopy d loop routines here anyway.


[EMAIL PROTECTED] wrote:
If you are running on any system it will cost you. The only question is, 
do you mind paying the price? Little things do add up. 
If you are on UniData run this. Plug in your own huge file.
OPEN 'MASTER' TO MASTER ELSE STOP
SELECT MASTER
START.CPU = SYSTEM(9)
LOOP
READNEXT ID ELSE EXIT
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU
SELECT MASTER
START.CPU = SYSTEM(9)
LOOP
WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
END.CPU = SYSTEM(9)
CRT END.CPU-START.CPU

I get 
290
320


Bruce M Neylon
Health Care Management Group 





Dave S 
Sent by: [EMAIL PROTECTED]
06/17/2004 01:09 PM
Please respond to u2-users


To: [EMAIL PROTECTED]
cc: 
Subject: Re: [U2] [UV] WHILE READNEXT id DO

If you are running on some old school system, it may cost you.

But don't these programs on Unidata all get compiled into C ?

[EMAIL PROTECTED] wrote:
Why use the WHILE 1 DO? Why not
LOOP
READNEXT ID ELSE EXIT
REPEAT
Doesn't the WHILE 1 DO cost? not that it would cost much. :-)

Bruce M Neylon
Health Care Management Group 





Dave S 
Sent by: [EMAIL PROTECTED]
06/17/2004 09:56 AM
Please respond to u2-users


To: [EMAIL PROTECTED]
cc: 
Subject: Re: [U2] [UV] WHILE READNEXT id DO

I like to use :

LOOP WHILE 1 DO
READNEXT ID ELSE EXIT
REPEAT
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


-
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
---
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/


-
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread BNeylon
That's OK.  I'm used to hearing, but that's the way we've always done it 
:-)
Have a good one.

Bruce M Neylon
Health Care Management Group 





Dave S [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
06/17/2004 03:21 PM
Please respond to u2-users

 
To: [EMAIL PROTECTED]
cc: 
Subject:Re: [U2] [UV] WHILE READNEXT id DO

No thanks. I don't have any time for that today or tomorrow either.
 
We are running SB+ here and don't write this little loopy d loop routines 
here anyway.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Allen E. Elwood \(CA\)
Good point Glenn,

Any programming language that supports constructs which allow the
development of loops and subroutines that do not need GOTO's can be used to
create structured programs.  Another hallmark of structured programs is the
usage of text labels instead of numeric.
So, GOSUB DETERMINE.PREVIOUS.STATUS
can be used instead of GOSUB 17250...

Keeping logical constructs separate from 'doing stuff' is another good
practice, as is parsing all variables after the READ, having only one main
print routine (if printing), keeping subroutines from getting too big, not
going down too many levels in subroutines, the list goes on and on.  I have
been told that my basic programs look more like structured COBOL programs
than most basic programs.  And it's pretty true.

I agree that
OPEN '', ITEM.MASTER TO 'ITEM.MASTER' ELSE GOTO ABORT.ROUTINE
is allowable!  And remember, it's not GOTO's that kill, it's the person
pulling the trigger!!!  ;-)  (Or would that be the person hitting the return
key?!!?)

This is an example from one of my programs that is used to create the demand
file prior to sending the data to a 3rd party forecasting system Demand
Solutions.  As you can see, it is quite easy to create structured code in
BASIC!

MAIN.SETUP.SECTION:*
  GOSUB OPEN.AND.INIT
  GOSUB SELECT.DEMAND.MAPS
  IF NOT(ERROR) THEN
GOSUB MAIN.PROCESSING.LOOP
  END
  GOSUB FINISH.UP
END.MAIN.SETUP.SECTION:*
STOP
MAIN.PROCESSING.LOOP:*
  LOOP
READNEXT TM.ID FROM 1 ELSE EXIT
GOSUB READ.DEMAND.MAP
IF ERROR THEN CONTINUE
GOSUB PREPROCESS.PURGE
IF ERROR THEN CONTINUE
IF (FILE.SOURCE = 1 OR FILE.SOURCE = 3) THEN
  *Process SA file for file opts 1 and 3
  FILE.HANDLE = SA
  FILE.SELECT = 'SA'
  GOSUB SELECT.SA
  IF ERROR THEN CONTINUE
  GOSUB PROCESS.SA
END
IF (FILE.SOURCE = 2 OR FILE.SOURCE = 3) THEN
  *Process SA.HIST file for file opts 2 and 3
  FILE.HANDLE = SA.HIST
  FILE.SELECT = 'SA.HIST'
  GOSUB SELECT.SA
  IF ERROR THEN CONTINUE
  GOSUB PROCESS.SA
END
MSG=''
GOSUB OUTPUT.LINE
MSG='End of Listing for Demand Map ':MAP.NAME:', ':DESC
GOSUB OUTPUT.LINE
  REPEAT
RETURN

Allen E. Elwood
Senior Programmer Analyst
Curnayn and Associates
Direct (818) 361-5251
Fax(818) 361-5251
Cell(818) 800-5595
Home (818) 361-7217

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Glenn Herbert
Sent: Thursday, June 17, 2004 12:01 PM
To: [EMAIL PROTECTED]
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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Dave S
I worked for one company that required us to take a programming test.
 
We had to code a program without any goto's to pass the test.
 
Once employed, all programmers were required to follow the programming standards
there.

[EMAIL PROTECTED] wrote:
That's OK. I'm used to hearing, but that's the way we've always done it 
:-)
Have a good one.

Bruce M Neylon
Health Care Management Group 





Dave S 
Sent by: [EMAIL PROTECTED]
06/17/2004 03:21 PM
Please respond to u2-users


To: [EMAIL PROTECTED]
cc: 
Subject: Re: [U2] [UV] WHILE READNEXT id DO

No thanks. I don't have any time for that today or tomorrow either.

We are running SB+ here and don't write this little loopy d loop routines 
here anyway.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


-
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Mark Johnson
I'd love to see this test. What's the hatred with the GOTO's. If they're so
bad, then let's vote to remove them from the compiler. Let's remove RETURN
TO and CLEAR while we're at it as well.


- Original Message -
From: Dave S [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 5:49 PM
Subject: Re: [U2] [UV] WHILE READNEXT id DO


 I worked for one company that required us to take a programming test.

 We had to code a program without any goto's to pass the test.

 Once employed, all programmers were required to follow the programming
standards
 there.

 [EMAIL PROTECTED] wrote:
 That's OK. I'm used to hearing, but that's the way we've always done it
 :-)
 Have a good one.

 Bruce M Neylon
 Health Care Management Group





 Dave S
 Sent by: [EMAIL PROTECTED]
 06/17/2004 03:21 PM
 Please respond to u2-users


 To: [EMAIL PROTECTED]
 cc:
 Subject: Re: [U2] [UV] WHILE READNEXT id DO

 No thanks. I don't have any time for that today or tomorrow either.

 We are running SB+ here and don't write this little loopy d loop routines
 here anyway.
 ---
 u2-users mailing list
 [EMAIL PROTECTED]
 To unsubscribe please visit http://listserver.u2ug.org/


 -
 Do you Yahoo!?
 Yahoo! Mail - Helps protect you from nasty viruses.
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Mark Johnson
Don't forget that the second set has the benefit of the first set leaving
some of the data in virtual memory, hence the second set would have been
longer.

my 1 cent

How about this on your similar UD system. Correct typing implied.

OPEN MASTER ELSE STOP
SELECT MASTER
START=SYS9
10 READNEXT ID ELSE GOTO 15
GOTO 10
15 END=SYS9
PRINT END-START


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 17, 2004 2:25 PM
Subject: Re: [U2] [UV] WHILE READNEXT id DO


 If you are running on any system it will cost you.  The only question is,
 do you mind paying the price?  Little things do add up.
 If you are on UniData run this. Plug in your own huge file.
 OPEN 'MASTER' TO MASTER ELSE STOP
 SELECT MASTER
 START.CPU = SYSTEM(9)
 LOOP
 READNEXT ID ELSE EXIT
 REPEAT
 END.CPU = SYSTEM(9)
 CRT END.CPU-START.CPU
 SELECT MASTER
 START.CPU = SYSTEM(9)
 LOOP
 WHILE 1 DO
 READNEXT ID ELSE EXIT
 REPEAT
 END.CPU = SYSTEM(9)
 CRT END.CPU-START.CPU

 I get
 290
 320


 Bruce M Neylon
 Health Care Management Group





 Dave S [EMAIL PROTECTED]
 Sent by: [EMAIL PROTECTED]
 06/17/2004 01:09 PM
 Please respond to u2-users


 To: [EMAIL PROTECTED]
 cc:
 Subject:Re: [U2] [UV] WHILE READNEXT id DO

 If you are running on some old school system, it may cost you.

 But don't these programs on Unidata all get compiled into C ?

 [EMAIL PROTECTED] wrote:
 Why use the WHILE 1 DO? Why not
 LOOP
 READNEXT ID ELSE EXIT
 REPEAT
 Doesn't the WHILE 1 DO cost? not that it would cost much. :-)

 Bruce M Neylon
 Health Care Management Group





 Dave S
 Sent by: [EMAIL PROTECTED]
 06/17/2004 09:56 AM
 Please respond to u2-users


 To: [EMAIL PROTECTED]
 cc:
 Subject: Re: [U2] [UV] WHILE READNEXT id DO

 I like to use :

 LOOP WHILE 1 DO
 READNEXT ID ELSE EXIT
 REPEAT
 ---
 u2-users mailing list
 [EMAIL PROTECTED]
 To unsubscribe please visit http://listserver.u2ug.org/


 -
 Do you Yahoo!?
 New and Improved Yahoo! Mail - Send 10MB messages!
 ---
 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/


Re: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Mark Johnson
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/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Ross Ferris
Last time I looked UD Basic was still interpreted ... happy to be wrong (I thought 
jBASE was the only environment that went the real compiler route)

Ross Ferris
Stamina Software
Visage  an Evolution in Software Development


-Original Message-
From: [EMAIL PROTECTED] [mailto:owner-u2-
[EMAIL PROTECTED] On Behalf Of Dave S
Sent: Friday, 18 June 2004 3:10 AM
To: [EMAIL PROTECTED]
Subject: Re: [U2] [UV] WHILE READNEXT id DO

If you are running on some old school system, it may cost you.

But don't these programs on Unidata all get compiled into C ?

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.707 / Virus Database: 463 - Release Date: 15/06/2004
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


FW: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Allen E. Elwood \(CA\)
(resending this one sans joke that apparently was non-pc)
Good point Glenn,

Any programming language that supports constructs which allow the
development of loops and subroutines that do not need GOTO's can be used to
create structured programs.  Another hallmark of structured programs is the
usage of text labels instead of numeric.
So, GOSUB DETERMINE.PREVIOUS.STATUS
can be used instead of GOSUB 17250...

Keeping logical constructs separate from 'doing stuff' is another good
practice, as is parsing all variables after the READ, having only one main
print routine (if printing), keeping subroutines from getting too big, not
going down too many levels in subroutines, the list goes on and on.  I have
been told that my basic programs look more like structured COBOL programs
than most basic programs.  And it's pretty true.

I agree that
OPEN '', ITEM.MASTER TO 'ITEM.MASTER' ELSE GOTO ABORT.ROUTINE
is allowable!

This is an example from one of my programs that is used to create the demand
file prior to sending the data to a 3rd party forecasting system Demand
Solutions.  As you can see, it is quite easy to create structured code in
BASIC!

MAIN.SETUP.SECTION:*
  GOSUB OPEN.AND.INIT
  GOSUB SELECT.DEMAND.MAPS
  IF NOT(ERROR) THEN
GOSUB MAIN.PROCESSING.LOOP
  END
  GOSUB FINISH.UP
END.MAIN.SETUP.SECTION:*
STOP
MAIN.PROCESSING.LOOP:*
  LOOP
READNEXT TM.ID FROM 1 ELSE EXIT
GOSUB READ.DEMAND.MAP
IF ERROR THEN CONTINUE
GOSUB PREPROCESS.PURGE
IF ERROR THEN CONTINUE
IF (FILE.SOURCE = 1 OR FILE.SOURCE = 3) THEN
  *Process SA file for file opts 1 and 3
  FILE.HANDLE = SA
  FILE.SELECT = 'SA'
  GOSUB SELECT.SA
  IF ERROR THEN CONTINUE
  GOSUB PROCESS.SA
END
IF (FILE.SOURCE = 2 OR FILE.SOURCE = 3) THEN
  *Process SA.HIST file for file opts 2 and 3
  FILE.HANDLE = SA.HIST
  FILE.SELECT = 'SA.HIST'
  GOSUB SELECT.SA
  IF ERROR THEN CONTINUE
  GOSUB PROCESS.SA
END
MSG=''
GOSUB OUTPUT.LINE
MSG='End of Listing for Demand Map ':MAP.NAME:', ':DESC
GOSUB OUTPUT.LINE
  REPEAT
RETURN

Allen E. Elwood
Senior Programmer Analyst
Curnayn and Associates
Direct (818) 361-5251
Fax(818) 361-5251
Cell(818) 800-5595
Home (818) 361-7217

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Glenn Herbert
Sent: Thursday, June 17, 2004 12:01 PM
To: [EMAIL PROTECTED]
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/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Ken Wallis
Mark Johnson wrote:

 This appears to be the semi-annual GOTO holy war.

But only one side is fighting.

Leave it alone Mark.  Nothing good came of it last time, and nothing good
will come of it this time.  Those who believe GOTOs have their uses will not
be convinced otherwise by a thread on a mailing list like this, and those of
us who avoid GOTOs completely will similarly not change their mindset for
you.

 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.

Not that I intend to take this further Mark, but are you seriously trying to
imply that sorting, breakpointing and totalling cannot be done well without
using GOTO?

Although I have trouble envisioning it, I'm confident that there is a coding
solution to this specific problem that makes use of GOTO, and I'm sure that
you have such a solution in mind.  Great.  If that makes you productive and
you clients happy, then I'm all for it.  Just so long as I don't have to
consult at one of your client sites once you've retired.  My mind simply
doesn't work that way.  I tend to think about iteration before I look at
branches.  That drives me towards nested LOOPs and all sorts of structures
in which GOTOs are, to my mind, both superfluous and dangerous.

I don't want to get into this Holy War.  Time was when I'd have taken up the
cudgel, but it doesn't achieve anything when you are more than an arm's
length away!  I'd rather disagree without becoming disagreeable.  Please
simply take it as read that any problem that can be solved in BASIC using a
GOTO, can also be solved without using it.  Similarly, I assume that
anything I can code a solution to has at least one equivalent solution that
involves a GOTO statement.

Cheers,

Ken
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] WHILE READNEXT id DO

2004-06-17 Thread Allen E. Elwood \(CA\)
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/