Re: [U2] [u2] : Cleaner Case Statement

2007-07-27 Thread MAJ Programming
I agree with Martin.

The CASE statement is just a more human readable form of multiple IF
statements. I switch TO case statements when the logic becomes a little
convoluded and I only want one result. That, in essense is the purpose of
CASE, only one should fall true (or none if you omit the bailout CASE 1)

I've seen
CASE X=1 ; GOSUB 10
followed later in the same block with
CASE X#1 ; GOSUB 20

so the construct may be a little hard to understand.

Our is one of the more powerful forms of case. VB's tests only one variable
(IIRC) where as MV tests combinations as well.

My 1 cent.
- Original Message -
From: Martin Phillips [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 12:37 PM
Subject: Re: [U2] [u2] : Cleaner Case Statement


 Hi Bill,

 Unlike languages such as C, Basic does not allow multiple conditions in
the
 way in which you are looking to do. In terms of run time performance or
 program size, if it really is just a GOSUB, there whould be little
 disadvantage in writing the more verbose form of your first example.


 Martin Phillips
 Ladybridge Systems Ltd
 17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
 +44-(0)1604-709200
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-27 Thread MAJ Programming
I think this should not be an exercise in using other forms of logic. The
CASE construct is actually pretty self documenting.
- Original Message -
From: Manu Fernandes [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 12:44 PM
Subject: Re: [U2] [u2] : Cleaner Case Statement


 Try this

 ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

 Manu
 - Original Message -
 From: Brutzman, Bill [EMAIL PROTECTED]
 To: u2-users@listserver.u2ug.org
 Sent: Wednesday, July 25, 2007 5:48 PM
 Subject: [U2] [u2] : Cleaner Case Statement


  How can this structure be cleaned-up?
 
   begin case
 case Ans = 'A'  ;  gosub Check.A
 case Ans = 'B'  ;  gosub Check.B
 case Ans = '2'  ;  gosub Check.B
   end   case
 
  The following is more difficult to read.
 
   begin case
 case Ans = 'A'   ;  gosub Check.A
 case Ans = 'B' or Ans = '2'  ;  gosub Check.B
   end   case
 
  I would like something like...
 
   begin case
 case Ans = 'A'  ;  gosub Check.A
 case Ans = 'B'
 case Ans = '2'  ;  gosub Check.B
   end   case
 
  so that the gosub Check.B command is not repeated.  I have tried a few
  alternatives without a victory.
 
  Suggestions would be appreciated.
 
  --Bill
  ---
  u2-users mailing list
  u2-users@listserver.u2ug.org
  To unsubscribe please visit http://listserver.u2ug.org/
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-27 Thread MAJ Programming
I'll defend ON GOSUB here.

I inherit a ton of prior code and can see the value in maint programs. If
each field on the screen is labeled 10, 20, 30 and within that section there
is a closing statement before the RETURN labeled 15 PRINT @(x,y):REC1:,
then I've enjoyed have the NEW record cycler be

FOR I=1 TO 5
ON I GOSUB 10,20,30,40,50
NEXT I

and the print of the record be:

FOR I=1 TO 5
ON I GOSUB 15,25,35,45,55
NEXT I

At the Change Which Line, it's a repeat of the 10,20,30 sequence.

I don't care for worded labels in ON GOSUB as it's hard to read with the
commas and a lot of worded labels have periods which is also confusing.
Likewise for called sub parameter strings. Put a space after each command
and the variables come to life.

My 1 cent

- Original Message -
From: Perry Taylor [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 2:52 PM
Subject: RE: [U2] [u2] : Cleaner Case Statement


 Someone want to explain to me why ON GOSUB is bdd ?


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Karen Bessel
 Sent: Wednesday, July 25, 2007 1:06 PM
 To: u2-users@listserver.u2ug.org
 Subject: RE: [U2] [u2] : Cleaner Case Statement

 ON GOSUB..Bad. Bill, that is a bad coding practice -
 don't go there.


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
 Sent: Wednesday, July 25, 2007 12:44 PM
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] [u2] : Cleaner Case Statement

 Try this

 ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

 Manu
 - Original Message -
 From: Brutzman, Bill [EMAIL PROTECTED]
 To: u2-users@listserver.u2ug.org
 Sent: Wednesday, July 25, 2007 5:48 PM
 Subject: [U2] [u2] : Cleaner Case Statement


  How can this structure be cleaned-up?
 
   begin case
 case Ans = 'A'  ;  gosub Check.A
 case Ans = 'B'  ;  gosub Check.B
 case Ans = '2'  ;  gosub Check.B
   end   case
 
  The following is more difficult to read.
 
   begin case
 case Ans = 'A'   ;  gosub Check.A
 case Ans = 'B' or Ans = '2'  ;  gosub Check.B
   end   case
 
  I would like something like...
 
   begin case
 case Ans = 'A'  ;  gosub Check.A
 case Ans = 'B'
 case Ans = '2'  ;  gosub Check.B
   end   case
 
  so that the gosub Check.B command is not repeated.  I have tried a
 few
  alternatives without a victory.
 
  Suggestions would be appreciated.
 
  --Bill
  ---
  u2-users mailing list
  u2-users@listserver.u2ug.org
  To unsubscribe please visit http://listserver.u2ug.org/
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/

 CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is
for the sole use of the intended recipient(s) and may contain confidential
and privileged information.  Any unauthorized review, use, disclosure or
distribution is prohibited. ZirMed, Inc. has strict policies regarding the
content of e-mail communications, specifically Protected Health Information,
any communications containing such material will be returned to the
originating party with such advisement noted. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies
of the original message.
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-26 Thread SP
This is really ugly. In the company I work for such things are strictly 
forbidden by Standards.




- Original Message - 
From: Manu Fernandes [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:44 PM
Subject: Re: [U2] [u2] : Cleaner Case Statement



Try this
ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu - Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement



How can this structure be cleaned-up?

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'  ;  gosub Check.B   case Ans = '2'  ;  gosub 
Check.B  end   case


The following is more difficult to read.

 begin case
   case Ans = 'A'   ;  gosub Check.A
   case Ans = 'B' or Ans = '2'  ;  gosub Check.B   end   case

I would like something like...

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'case Ans = '2'  ;  gosub Check.B  end   case

so that the gosub Check.B command is not repeated.  I have tried a few
alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/ 

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


[U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Brutzman, Bill
How can this structure be cleaned-up?

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case

The following is more difficult to read.

  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case

I would like something like...

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case

so that the gosub Check.B command is not repeated.  I have tried a few
alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Karen Bessel
The 2nd set of syntax is the only one that will work if you want to do
the GOSUB when ANS equals either B or 2.



I don't agree that it's hard to read, but I don't like having multiple
statements on one line, separated by semicolons, I prefer to have the
case and the gosub on separate lines, but that's a matter of personal
preference.



Karen













-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
Sent: Wednesday, July 25, 2007 11:49 AM
To: 'u2-users@listserver.u2ug.org'
Subject: [U2] [u2] : Cleaner Case Statement



How can this structure be cleaned-up?



  begin case

case Ans = 'A'  ;  gosub Check.A

case Ans = 'B'  ;  gosub Check.B

case Ans = '2'  ;  gosub Check.B

  end   case



The following is more difficult to read.



  begin case

case Ans = 'A'   ;  gosub Check.A

case Ans = 'B' or Ans = '2'  ;  gosub Check.B

  end   case



I would like something like...



  begin case

case Ans = 'A'  ;  gosub Check.A

case Ans = 'B'

case Ans = '2'  ;  gosub Check.B

  end   case



so that the gosub Check.B command is not repeated.  I have tried a few

alternatives without a victory.



Suggestions would be appreciated.



--Bill

---

u2-users mailing list

u2-users@listserver.u2ug.org

To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Kevin King
On 7/25/07, Brutzman, Bill [EMAIL PROTECTED] wrote:

 How can this structure be cleaned-up?

   begin case
 case Ans = 'A'  ;  gosub Check.A
 case Ans = 'B'  ;  gosub Check.B
 case Ans = '2'  ;  gosub Check.B
   end   case


If this is all you need, why not:

IF (Ans = 'A') THEN
  GOSUB Check.A
END ELSE
  GOSUB Check.B
END

Or is your example a simplification?
-Kevin
http://www.PrecisOnline.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Manu Fernandes
Try this 


ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu 
- Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement



How can this structure be cleaned-up?

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'  ;  gosub Check.B   
   case Ans = '2'  ;  gosub Check.B  
 end   case


The following is more difficult to read.

 begin case
   case Ans = 'A'   ;  gosub Check.A
   case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
 end   case


I would like something like...

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'
   case Ans = '2'  ;  gosub Check.B  
 end   case


so that the gosub Check.B command is not repeated.  I have tried a few
alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Martin Phillips

Hi Bill,

Unlike languages such as C, Basic does not allow multiple conditions in the 
way in which you are looking to do. In terms of run time performance or 
program size, if it really is just a GOSUB, there whould be little 
disadvantage in writing the more verbose form of your first example.



Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton, NN4 6DB
+44-(0)1604-709200 
---

u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Dave Davis
case Ans = 'B' in the third set means do nothing when Ans = 'B', and
stop evaluating cases.

Surely you wouldn't wish to break millions of lines of code by changing
the meaning of the case syntax.

The gosubs should go on their own line.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brutzman, Bill
Sent: Wednesday, July 25, 2007 11:49 AM
To: 'u2-users@listserver.u2ug.org'
Subject: [U2] [u2] : Cleaner Case Statement

How can this structure be cleaned-up?

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case

The following is more difficult to read.

  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case

I would like something like...

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case

so that the gosub Check.B command is not repeated.  I have tried a few
alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread David A. Green
The first structure emphasizes program flow based on Ans and is very
readable.  The second structure show program branching and is also readable.
Another approach might be thus:

  Alpha.Cmds= 
  Alpha.Cmds1, -1 = A
  Beta.Cmds = 
  Beta.Cmds1, -1  = B
  Beta.Cmds1, -1  = 2
...
  begin case
case Ans matches Alpha.Cmds  ;  gosub Check.A
case Ans matches Beta.Cmds   ;  gosub Check.B   
  end   case

David A. Green
DAG Consulting
480.813.1725

-Original Message-
 How can this structure be cleaned-up?

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case

The following is more difficult to read.

  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case

I would like something like...

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case

so that the gosub Check.B command is not repeated.  I have tried a few
alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Susan Lynch

Kevin,

What if the answer is Q?

I almost always put in a CASE 1 statement to catch anything that resulted 
from a later code revision by a colleague or someone who follows me in a 
job!  (The 'almost' is to exclude one-shot programs that nobody should ever 
run again.)


Susan  Lynch
F.W. Davison  Company, Inc.


- Original Message - 
From: Kevin King [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 12:16 PM
Subject: Re: [U2] [u2] : Cleaner Case Statement



On 7/25/07, Brutzman, Bill [EMAIL PROTECTED] wrote:


How can this structure be cleaned-up?

  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B
case Ans = '2'  ;  gosub Check.B
  end   case



If this is all you need, why not:

IF (Ans = 'A') THEN
 GOSUB Check.A
END ELSE
 GOSUB Check.B
END

Or is your example a simplification?
-Kevin
http://www.PrecisOnline.com
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Dave Davis
Not good if answer is not limited to one character wide.

Isn't ON  GOSUB out of style?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
- Original Message -
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a 
 few alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Perry Taylor
Someone want to explain to me why ON GOSUB is bdd ?
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karen Bessel
Sent: Wednesday, July 25, 2007 1:06 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

ON GOSUB..Bad. Bill, that is a bad coding practice -
don't go there.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu 
- Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a
few
 alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited. ZirMed, Inc. has strict policies regarding the 
content of e-mail communications, specifically Protected Health Information, 
any communications containing such material will be returned to the originating 
party with such advisement noted. If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Rotella, Leon M.
Just to be different...

Why not add a new label called Check.2 put it right before the label
Check.B

Then the code would look like:

 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.2
case 1 ; gosub error.condition or null  
  end   case

This would help from a maintenance standpoint, if later on Check.2
needed it's own code differing than Check.B




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave Davis
Sent: Wednesday, July 25, 2007 1:22 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Not good if answer is not limited to one character wide.

Isn't ON  GOSUB out of style?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
- Original Message -
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a 
 few alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread gerry-u2ug
I don't know either - this thread is the 1st time I ever heard that one.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Perry Taylor
Sent: July 25, 2007 02:53 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Someone want to explain to me why ON GOSUB is bdd ?
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karen Bessel
Sent: Wednesday, July 25, 2007 1:06 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

ON GOSUB..Bad. Bill, that is a bad coding practice -
don't go there.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu 
- Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a
few
 alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and privileged information.  Any unauthorized review, use,
disclosure or distribution is prohibited. ZirMed, Inc. has strict
policies regarding the content of e-mail communications, specifically
Protected Health Information, any communications containing such
material will be returned to the originating party with such advisement
noted. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Dan Fitzgerald
You still have an oxhp.com address? I thought that oxhp was gone?

How're you doin'?

Dan Fitzgerald

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rotella, Leon M.
Sent: Wednesday, July 25, 2007 2:54 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Just to be different...

Why not add a new label called Check.2 put it right before the label
Check.B

Then the code would look like:

 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.2
case 1 ; gosub error.condition or null  
  end   case

This would help from a maintenance standpoint, if later on Check.2
needed it's own code differing than Check.B




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dave Davis
Sent: Wednesday, July 25, 2007 1:22 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Not good if answer is not limited to one character wide.

Isn't ON  GOSUB out of style?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this 

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
- Original Message -
From: Brutzman, Bill [EMAIL PROTECTED]
To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement


 How can this structure be cleaned-up?
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'  ;  gosub Check.B   
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 The following is more difficult to read.
 
  begin case
case Ans = 'A'   ;  gosub Check.A
case Ans = 'B' or Ans = '2'  ;  gosub Check.B   
  end   case
 
 I would like something like...
 
  begin case
case Ans = 'A'  ;  gosub Check.A
case Ans = 'B'
case Ans = '2'  ;  gosub Check.B  
  end   case
 
 so that the gosub Check.B command is not repeated.  I have tried a 
 few alternatives without a victory.
 
 Suggestions would be appreciated.
 
 --Bill
 ---
 u2-users mailing list
 u2-users@listserver.u2ug.org
 To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Susan Lynch

One possible reason why it might be considered less than optimal:


From the UniData Basic Commands manual:


...If expr is less than or equal to 1, UniData transfers program control to 
the subroutine starting at the first label in the list...


So if ANS is Q in the code fragment below, you gosub Check.A. (Unless you 
are using BASICTYPE P or BASICTYPE M, in which case it drops to the next 
line of code - that is from a note on the previous page to the last 
quote...) If that is what you really want, ok, but it is certainly not going 
to be clear to the next poor soul who has to maintain the code!  Or who 
might change the BASICTYPE and not realize the impact that it would have on 
your logic...


Susan Lynch
F. W. Davison  Company, Inc.


- Original Message - 
From: gerry-u2ug [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 3:36 PM
Subject: RE: [U2] [u2] : Cleaner Case Statement



I don't know either - this thread is the 1st time I ever heard that one.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Perry Taylor
Sent: July 25, 2007 02:53 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

Someone want to explain to me why ON GOSUB is bdd ?


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karen Bessel
Sent: Wednesday, July 25, 2007 1:06 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [u2] : Cleaner Case Statement

ON GOSUB..Bad. Bill, that is a bad coding practice -
don't go there.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Sent: Wednesday, July 25, 2007 12:44 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] [u2] : Cleaner Case Statement

Try this

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
- Original Message - 
From: Brutzman, Bill [EMAIL PROTECTED]

To: u2-users@listserver.u2ug.org
Sent: Wednesday, July 25, 2007 5:48 PM
Subject: [U2] [u2] : Cleaner Case Statement



How can this structure be cleaned-up?

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'  ;  gosub Check.B
   case Ans = '2'  ;  gosub Check.B
 end   case

The following is more difficult to read.

 begin case
   case Ans = 'A'   ;  gosub Check.A
   case Ans = 'B' or Ans = '2'  ;  gosub Check.B
 end   case

I would like something like...

 begin case
   case Ans = 'A'  ;  gosub Check.A
   case Ans = 'B'
   case Ans = '2'  ;  gosub Check.B
 end   case

so that the gosub Check.B command is not repeated.  I have tried a

few

alternatives without a victory.

Suggestions would be appreciated.

--Bill
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
is for the sole use of the intended recipient(s) and may contain
confidential and privileged information.  Any unauthorized review, use,
disclosure or distribution is prohibited. ZirMed, Inc. has strict
policies regarding the content of e-mail communications, specifically
Protected Health Information, any communications containing such
material will be returned to the originating party with such advisement
noted. If you are not the intended recipient, please contact the sender
by reply e-mail and destroy all copies of the original message.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Stevenson, Charles
From: Clifton Oliver
 Execution should flow top to bottom, not left to right, from a
comprehension viewpoint.

Comprehension contributes to Maintainability, the premiere attribute of
software quality.
Along same lines, each case block should test the same sort of thing.
Don't get sneaky for efficiency's sake.
(Note: Efficiency  Maintainability are often in tension.)

E.g.: You are sorting cobras, bugs, garter snakes, lizards, 
rattlesnakes.
The 2nd method below increases your chances of giving this to a junior
programmer, an important consideration when sorting vermin.

Don't do this:

   begin case
  case legs = 6   ; bug
  case legs = 4   ; lizard
  case red stripe ; garter snake
  case hood   ; cobra
  case rattles; rattlesnake
   end case

Do this instead:

   begin case
  case legs = 6   ; bug
  case legs = 4   ; lizard
  case legs = 0   ; * (snake)
 begin case
case red-stripe ; garter snake
case hood   ; cobra
case rattles; rattlesnake
 end case
   end case

cds
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [u2] : Cleaner Case Statement

2007-07-25 Thread Allen E. Elwood
Hi Karen

I've seen this used in after prompt subroutines, where there were literally
multiple hundreds of Subroutines to execute, based on the attr number.  In
that case it's cleaner, and might I add easier, than HUNDREDS of lines of
code that just say

CASE ATTR = 1
  GOSUB 1
SNIP 400 LINES OF CODE
CASE ATTR = 202
  GOSUB 202
SNIP ANOTHER 200 LINES OF CODE
CASE ATTR = 302
  GOSUB 302

Granted, you end up with multiple ON .. GOSUB statements because there
is a limit to how many GOSUBs you can have on one statement, but to have few
statements instead of 600+ lines of code *just for the control statements*
is 'better', imho.

Of course one could conceivably write a small program to generate the case
statements, and you wouldn't have all the typing to do, but I still think
the ON statement has it's place.

fwiw

Allen
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Karen Bessel

ON GOSUB..Bad. Bill, that is a bad coding practice -
don't go there.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Manu Fernandes
Try this

ON index('AB2',Ans,1) GOSUB Check.A, Check.B, Check.B

Manu
snip
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/