Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-25 Thread Keith Johnson [DATACOM]
Hi Will,

As I said, I don't use it myself, but a reason one might use
it is that one can easily cut and paste (or include) logic.

For example:
---
LOCKED
  put
  some
  generic
  logic
  here
END
---

regards, Keith


   WJohnson wrote:

   Why the extra lines?  Why not just
   IF A = TEST THEN
  gosub do.something
   END ELSE
  gosub do.something.else
   END

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-23 Thread Keith Johnson [DATACOM]
I prefer the layout of

IF A = TEST
   THEN GOSUB DO.SOMETHING  ;* Say why
   ELSE GOSUB DO.SOMETHING.ELSE ;* The reason

However, here is a form that's rarely used, but does work.

IF A = TEST
THEN ;* say why in a long-winded manner
   GOSUB DO.SOMETHING
END
ELSE ;* the reasoning behind the reason
   GOSUB DO.SOMETHING.ELSE
END

I don't use it myself, but it's very amenable to cut and paste programming.

Regards, Keith

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-23 Thread Wjhonson

Why the extra lines?  Why not just
IF A = TEST THEN
   gosub do.something
END ELSE
   gosub do.something.else
END




However, here is a form that's rarely used, but does work.
IF A = TEST
   THEN ;* say why in a long-winded manner
  GOSUB DO.SOMETHING
   END
   ELSE ;* the reasoning behind the reason
  GOSUB DO.SOMETHING.ELSE
   END





-Original Message-
From: Keith Johnson [DATACOM] keith.john...@datacom.co.nz
To: 'u2-users@listserver.u2ug.org' u2-users@listserver.u2ug.org
Sent: Mon, Apr 23, 2012 5:44 pm
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


I prefer the layout of
IF A = TEST
  THEN GOSUB DO.SOMETHING  ;* Say why
  ELSE GOSUB DO.SOMETHING.ELSE ;* The reason
However, here is a form that's rarely used, but does work.
IF A = TEST
   THEN ;* say why in a long-winded manner
  GOSUB DO.SOMETHING
   END
   ELSE ;* the reasoning behind the reason
  GOSUB DO.SOMETHING.ELSE
   END
I don't use it myself, but it's very amenable to cut and paste programming.
Regards, Keith
___
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-22 Thread Phil Walker
Also better for debugging...I think. you can break on the then clause or else 
clause rather than the IF

 -Original Message-
 From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
 boun...@listserver.u2ug.org] On Behalf Of Mecki Foerthmann
 Sent: Sunday, 22 April 2012 8:50 a.m.
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] Case Statement with only two cases... or for that matter...
 one case
 
 Well,
 
 I prefer:
 
 IF A = TEST THEN
 GOSUB DO.SOMETHING   ;* Say why
 END ELSE
 GOSUB DO.SOMETHING.ELSE  ;* The reason
 END
 
 IMO much more readable - because you see immediately that is is a
 conditional branching.
 It is also easier maintainable if you want to add some more code later or
 you need more conditions and want to change branching into case.
 
 And of course it will auto-indent correctly in my editor of choice ;-).
 
 On 20/04/2012 23:05, Kate Stanton wrote:
  Rather than:
 
  BEGIN CASE
 CASE A = TEST; GOSUB DO.SOMETHING
 CASE 1; GOSUB DO.SOMETHING.ELSE
  END CASE
 
  or
 
  IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB
 DO.SOMETHING.ELSE
 
  I prefer:
 
  IF A = TEST THEN GOSUB DO.SOMETHING ;* Say why
  ELSE  GOSUB DO.SOMETHING.ELSE  ;* The reason
 
  lining up the GOSUBs under each other, with comment making it clear
 why.
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-21 Thread Mecki Foerthmann

Well,

I prefer:

IF A = TEST THEN
   GOSUB DO.SOMETHING   ;* Say why
END ELSE
   GOSUB DO.SOMETHING.ELSE  ;* The reason
END

IMO much more readable - because you see immediately that is is a 
conditional branching.
It is also easier maintainable if you want to add some more code later 
or you need more conditions and want to change branching into case.


And of course it will auto-indent correctly in my editor of choice ;-).

On 20/04/2012 23:05, Kate Stanton wrote:

Rather than:

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

or

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

I prefer:

IF A = TEST THEN GOSUB DO.SOMETHING ;* Say why
ELSE  GOSUB DO.SOMETHING.ELSE  ;* The reason

lining up the GOSUBs under each other, with comment making it clear why.

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-21 Thread dennis bartlett
@Mecki.. What is your editor of choice, ie can you get it to indent 1
space? I've always been a standard FORMAT in ED fella, but the site I've
just joined doesn't want that, code must start right up against the edge, 
have 2 space indenting.. So hard to not instinctively FORMAT,  equally
hard to find that missing 'END' when I can't simply format, since the code
structure looks so foreign  squashed up.

Thanks
Dennis
On Apr 22, 2012 6:50 AM, Mecki Foerthmann mec...@gmx.net wrote:

 Well,

 I prefer:

 IF A = TEST THEN
   GOSUB DO.SOMETHING   ;* Say why
 END ELSE
   GOSUB DO.SOMETHING.ELSE  ;* The reason
 END

 IMO much more readable - because you see immediately that is is a
 conditional branching.
 It is also easier maintainable if you want to add some more code later or
 you need more conditions and want to change branching into case.

 And of course it will auto-indent correctly in my editor of choice ;-).

 On 20/04/2012 23:05, Kate Stanton wrote:

 Rather than:

 BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE

 or

 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

 I prefer:

 IF A = TEST THEN GOSUB DO.SOMETHING ;* Say why
 ELSE  GOSUB DO.SOMETHING.ELSE  ;* The reason

 lining up the GOSUBs under each other, with comment making it clear why.

 __**_
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/**mailman/listinfo/u2-usershttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-21 Thread Larry Hiscock
Dennis,

You didn't mention if you're on UV or UD, but the FORMAT command in AE (in
UD) has options for margin and indent.  You can do FORMAT -M0 -I2 to get the
format you specified.

Larry Hiscock
Western Computer Services

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of dennis bartlett
Sent: Saturday, April 21, 2012 4:06 PM
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases... or for that
matter... one case

@Mecki.. What is your editor of choice, ie can you get it to indent 1 space?
I've always been a standard FORMAT in ED fella, but the site I've just
joined doesn't want that, code must start right up against the edge,  have
2 space indenting.. So hard to not instinctively FORMAT,  equally hard to
find that missing 'END' when I can't simply format, since the code structure
looks so foreign  squashed up.

Thanks
Dennis
On Apr 22, 2012 6:50 AM, Mecki Foerthmann mec...@gmx.net wrote:

 Well,

 I prefer:

 IF A = TEST THEN
   GOSUB DO.SOMETHING   ;* Say why
 END ELSE
   GOSUB DO.SOMETHING.ELSE  ;* The reason
 END

 IMO much more readable - because you see immediately that is is a 
 conditional branching.
 It is also easier maintainable if you want to add some more code later 
 or you need more conditions and want to change branching into case.

 And of course it will auto-indent correctly in my editor of choice ;-).

 On 20/04/2012 23:05, Kate Stanton wrote:

 Rather than:

 BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE

 or

 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

 I prefer:

 IF A = TEST THEN GOSUB DO.SOMETHING ;* Say why
 ELSE  GOSUB DO.SOMETHING.ELSE  ;* The reason

 lining up the GOSUBs under each other, with comment making it clear why.

 __**_
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/**mailman/listinfo/u2-usershttp://listserv
 er.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-20 Thread Symeon Breen
Both read exactly the same to me - the case probably takes a bit longer to
digest cos there is more text to read, but there is not much in it. - come
on guys if you have to think about any of these then perhaps you need to
change career ?





-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
Sent: 19 April 2012 22:42
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases... or for that
matter... one case

The initial example was close to a good start... something like...

If XX then gosub YY  else  gosub ZZ

Replaced by

Begin case
   Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case

Except that now... note that readability is enhanced by [1] indenting... so
as to align text and [2] using mixed-case and camelCase typography.

--Bill
 
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 5:33 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Case Statement with only two cases... or for that
matter... one case

Give an example of, with what you would replace the If Then Else


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Symeon Breen
Or perhaps there were more cases in there, and over the years they have been
deleted. The last programmer to have done a  deletion probably should have
turned it into an if - but I don't think it really matters, any professional
programmer can figure out what it means in less than a  second ;)



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma
Sent: 19 April 2012 20:57
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

Logically they are clearly the same. It just depends on what the programmer
had in mind for the future of 'A'.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
Delivering Products, Services and Innovative Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Brian Leach
Many years ago, MV developers were taught not to use CASE as on the old PICK
machines they evaluated much (much) slower than the equivalent IFs -
probably a bad compiler job. So you ended up with hideous nested IF
statements that became practically unreadable.

My personal preference has always been to use CASE as it's much clearer,
especially when you start getting complex logic in-between. The only thing I
generally change is the traditional use of CASE 1 as the fall through
option, by equating OTHER to @TRUE so I can use Case OTHER.

And multi-line Ifs that are easier to follow in the debugger, especially if
you want to place a break point on either branch.

And in Will's example, it's all the same to the compiler.

As an extreme example, I once picked up some third party code written on a
McD machine. Every routine was written so it could fit on a single page of
an 80x24 terminal, including (which McD allowed) having labels in the middle
of a physical line (semi-colon delimited statements). And having to debug
that.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Symeon Breen
Sent: 20 April 2012 09:45
To: 'U2 Users List'
Subject: Re: [U2] Case Statement with only two cases

Or perhaps there were more cases in there, and over the years they have been
deleted. The last programmer to have done a  deletion probably should have
turned it into an if - but I don't think it really matters, any professional
programmer can figure out what it means in less than a  second ;)



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma
Sent: 19 April 2012 20:57
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

Logically they are clearly the same. It just depends on what the programmer
had in mind for the future of 'A'.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
Delivering Products, Services and Innovative Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Charlie Noah
A little different, but this reminds me of a program I saw once with 
nested IFs so deep they actually indented completely off an 80x24 screen 
with 3 space indents. I still shudder. The CASE construct was far more 
readable.


Charlie Noah

On 04-20-2012 4:50 AM, Brian Leach wrote:

Many years ago, MV developers were taught not to use CASE as on the old PICK
machines they evaluated much (much) slower than the equivalent IFs -
probably a bad compiler job. So you ended up with hideous nested IF
statements that became practically unreadable.

My personal preference has always been to use CASE as it's much clearer,
especially when you start getting complex logic in-between. The only thing I
generally change is the traditional use of CASE 1 as the fall through
option, by equating OTHER to @TRUE so I can use Case OTHER.

And multi-line Ifs that are easier to follow in the debugger, especially if
you want to place a break point on either branch.

And in Will's example, it's all the same to the compiler.

As an extreme example, I once picked up some third party code written on a
McD machine. Every routine was written so it could fit on a single page of
an 80x24 terminal, including (which McD allowed) having labels in the middle
of a physical line (semi-colon delimited statements). And having to debug
that.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Symeon Breen
Sent: 20 April 2012 09:45
To: 'U2 Users List'
Subject: Re: [U2] Case Statement with only two cases

Or perhaps there were more cases in there, and over the years they have been
deleted. The last programmer to have done a  deletion probably should have
turned it into an if - but I don't think it really matters, any professional
programmer can figure out what it means in less than a  second ;)



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Dave Laansma
Sent: 19 April 2012 20:57
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

Logically they are clearly the same. It just depends on what the programmer
had in mind for the future of 'A'.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
Delivering Products, Services and Innovative Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
CASE A = TEST; GOSUB DO.SOMETHING
CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Charles Stevenson

A respectful correction, Brian.

On 4/20/2012 4:50 AM, Brian Leach wrote:

it's all the same to the compiler.
-Original Message-
BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE
versus this
IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

-

Since we seem to be finding every nit in the bottom of this empty 
barrel, here's one more.

There are 2 compiler difference as shown by VLIST (UV10.2):

1: BEGIN CASE

2:CASE A = TEST; GOSUB DO.SOMETHING
2 0 : 06E eq A TEST  = $R0
2 8 : 2DE testfw $R0 00020:
2 00010 : 0A4 gosub  00060:


3:CASE 1; GOSUB DO.SOMETHING.ELSE
3 00018 : 0C2 jump   00038:
3 00020 : 2DE testfw 1 00038: -- Extra 
worthless test

3 00028 : 0A4 gosub  00062:

4: END CASE
4 00030 : 0C2 jump   00038: -- Extra worthless 
jump (to next line)

  
(Source lineup is goofy.  This jump is really part

   of source line 3.   RAID is confusing, too.

   A 
discussion for a different thread.)

5: IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
5 00038 : 06E eq A TEST  = $R0
5 00040 : 2DE testfw $R0 00058:
5 00048 : 0A4 gosub  00060:
5 00050 : 0C2 jump   00060:
5 00058 : 0A4 gosub  00062:

6: STOP
6 00060 : 190 stop


With the speed of today's machines it would be hard to find a place 
where that performance makes a difference.


Rocket could theoretically clean up both (or either independently) if 
the compiler was smart enough:


1. to know that a logical test outcome was predestined at compile time 
(It already does that sort of thing in other situations.).  Then it 
could  compile only 1 of the 2 paths the testfw takes.  (e.g. 0020x).  
Same for IF,  WHILE, or UNTIL constructs.


2. To recognize the final CASE before the END CASE never needs to jump 
(e.g., 0030x).


I wonder if we've already wasted more electrical  biological energy by 
me writing this email, dispersing it around the globe, and you reading 
it, than all the machine cycles wasted executing the 2 worthless tests 
in all the object scattered around the universe that Rocket could 
theoretically optimize.


cds


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Perry Taylor
I wonder if we've already wasted more electrical  biological energy by 
me writing this email, dispersing it around the globe, and you reading 
it, than all the machine cycles wasted executing the 2 worthless tests 
in all the object scattered around the universe that Rocket could 
theoretically optimize.  cds

Amen!

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charles Stevenson
Sent: Friday, April 20, 2012 7:28 AM
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

A respectful correction, Brian.

On 4/20/2012 4:50 AM, Brian Leach wrote:
 it's all the same to the compiler.
 -Original Message-
 BEGIN CASE
CASE A = TEST; GOSUB DO.SOMETHING
CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE
 versus this
 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
-

Since we seem to be finding every nit in the bottom of this empty 
barrel, here's one more.
There are 2 compiler difference as shown by VLIST (UV10.2):

1: BEGIN CASE

2:CASE A = TEST; GOSUB DO.SOMETHING
2 0 : 06E eq A TEST  = $R0
2 8 : 2DE testfw $R0 00020:
2 00010 : 0A4 gosub  00060:


3:CASE 1; GOSUB DO.SOMETHING.ELSE
3 00018 : 0C2 jump   00038:
3 00020 : 2DE testfw 1 00038: -- Extra 
worthless test
3 00028 : 0A4 gosub  00062:

4: END CASE
4 00030 : 0C2 jump   00038: -- Extra worthless 
jump (to next line)
   
(Source lineup is goofy.  This jump is really part
 
of source line 3.   RAID is confusing, too.
A 
discussion for a different thread.)

5: IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
5 00038 : 06E eq A TEST  = $R0
5 00040 : 2DE testfw $R0 00058:
5 00048 : 0A4 gosub  00060:
5 00050 : 0C2 jump   00060:
5 00058 : 0A4 gosub  00062:

6: STOP
6 00060 : 190 stop


With the speed of today's machines it would be hard to find a place 
where that performance makes a difference.

Rocket could theoretically clean up both (or either independently) if 
the compiler was smart enough:

1. to know that a logical test outcome was predestined at compile time 
(It already does that sort of thing in other situations.).  Then it 
could  compile only 1 of the 2 paths the testfw takes.  (e.g. 0020x).  
Same for IF,  WHILE, or UNTIL constructs.

2. To recognize the final CASE before the END CASE never needs to jump 
(e.g., 0030x).

I wonder if we've already wasted more electrical  biological energy by 
me writing this email, dispersing it around the globe, and you reading 
it, than all the machine cycles wasted executing the 2 worthless tests 
in all the object scattered around the universe that Rocket could 
theoretically optimize.

cds


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

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
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Dan Fitzgerald

Yeah, it's an interesting adjustment. For those of us who began coding on 
things like 8-bit 64Mhz 16Mb boxes, optimizing code was absolutely essential. 
Now, my desktop is a 4-core 2.8Ghz (you can get an 8 core I7 laptop for under 
$700), 8Gb of RAM 64 bit machine, and it's nearly obsolete. When I code (or 
review code), I'm not so much looking to wrest out every last system call 
(although I still do it out of habit), I'm just looking to make sure there are 
no egregious errors that will affect performance (or stability, or...), like 
executing a select instead of doing an internal one. Given a minimum of 
self-created bottlenecks, disk IO is still the limiting factor, (usually) not 
CPU cycles, especially if your OS isn't bloatware. In a few short years, we'll 
have solid state disks and a new set of problems. BTW, anyone see IBM's new 
offering, Pure System? In many ways, a 180 degree turn: everything is back in 
one rack: cpu's, storage, networking... 
  Date: Fri, 20 Apr 2012 08:27:48 -0500
 From: stevenson.c...@gmail.com
 To: u2-users@listserver.u2ug.org
 Subject: Re: [U2] Case Statement with only two cases
 
 A respectful correction, Brian.
 
 On 4/20/2012 4:50 AM, Brian Leach wrote:
  it's all the same to the compiler.
  -Original Message-
  BEGIN CASE
 CASE A = TEST; GOSUB DO.SOMETHING
 CASE 1; GOSUB DO.SOMETHING.ELSE
  END CASE
  versus this
  IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
 -
 
 Since we seem to be finding every nit in the bottom of this empty 
 barrel, here's one more.
 There are 2 compiler difference as shown by VLIST (UV10.2):
 
 1: BEGIN CASE
 
 2:CASE A = TEST; GOSUB DO.SOMETHING
 2 0 : 06E eq A TEST  = $R0
 2 8 : 2DE testfw $R0 00020:
 2 00010 : 0A4 gosub  00060:
 
 
 3:CASE 1; GOSUB DO.SOMETHING.ELSE
 3 00018 : 0C2 jump   00038:
 3 00020 : 2DE testfw 1 00038: -- Extra 
 worthless test
 3 00028 : 0A4 gosub  00062:
 
 4: END CASE
 4 00030 : 0C2 jump   00038: -- Extra worthless 
 jump (to next line)

 (Source lineup is goofy.  This jump is really part
  
 of source line 3.   RAID is confusing, too.
 A 
 discussion for a different thread.)
 
 5: IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
 5 00038 : 06E eq A TEST  = $R0
 5 00040 : 2DE testfw $R0 00058:
 5 00048 : 0A4 gosub  00060:
 5 00050 : 0C2 jump   00060:
 5 00058 : 0A4 gosub  00062:
 
 6: STOP
 6 00060 : 190 stop
 
 
 With the speed of today's machines it would be hard to find a place 
 where that performance makes a difference.
 
 Rocket could theoretically clean up both (or either independently) if 
 the compiler was smart enough:
 
 1. to know that a logical test outcome was predestined at compile time 
 (It already does that sort of thing in other situations.).  Then it 
 could  compile only 1 of the 2 paths the testfw takes.  (e.g. 0020x).  
 Same for IF,  WHILE, or UNTIL constructs.
 
 2. To recognize the final CASE before the END CASE never needs to jump 
 (e.g., 0030x).
 
 I wonder if we've already wasted more electrical  biological energy by 
 me writing this email, dispersing it around the globe, and you reading 
 it, than all the machine cycles wasted executing the 2 worthless tests 
 in all the object scattered around the universe that Rocket could 
 theoretically optimize.
 
 cds
 
 
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users
  
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Brian Leach
Charles

I stand corrected!

Edit: it *should be* all the same to the compiler (if the compiler knew what
it was doing)..

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charles Stevenson
Sent: 20 April 2012 14:28
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

A respectful correction, Brian.

On 4/20/2012 4:50 AM, Brian Leach wrote:
 it's all the same to the compiler.
 -Original Message-
 BEGIN CASE
CASE A = TEST; GOSUB DO.SOMETHING
CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE
 versus this
 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
-

Since we seem to be finding every nit in the bottom of this empty barrel,
here's one more.
There are 2 compiler difference as shown by VLIST (UV10.2):

1: BEGIN CASE

2:CASE A = TEST; GOSUB DO.SOMETHING
2 0 : 06E eq A TEST  = $R0
2 8 : 2DE testfw $R0 00020:
2 00010 : 0A4 gosub  00060:


3:CASE 1; GOSUB DO.SOMETHING.ELSE
3 00018 : 0C2 jump   00038:
3 00020 : 2DE testfw 1 00038: -- Extra 
worthless test
3 00028 : 0A4 gosub  00062:

4: END CASE
4 00030 : 0C2 jump   00038: -- Extra worthless 
jump (to next line)
 
(Source lineup is goofy.  This jump is really part
 
of source line 3.   RAID is confusing, too.
 
A discussion for a different thread.)

5: IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
5 00038 : 06E eq A TEST  = $R0
5 00040 : 2DE testfw $R0 00058:
5 00048 : 0A4 gosub  00060:
5 00050 : 0C2 jump   00060:
5 00058 : 0A4 gosub  00062:

6: STOP
6 00060 : 190 stop


With the speed of today's machines it would be hard to find a place where
that performance makes a difference.

Rocket could theoretically clean up both (or either independently) if the
compiler was smart enough:

1. to know that a logical test outcome was predestined at compile time (It
already does that sort of thing in other situations.).  Then it could
compile only 1 of the 2 paths the testfw takes.  (e.g. 0020x).  
Same for IF,  WHILE, or UNTIL constructs.

2. To recognize the final CASE before the END CASE never needs to jump
(e.g., 0030x).

I wonder if we've already wasted more electrical  biological energy by me
writing this email, dispersing it around the globe, and you reading it, than
all the machine cycles wasted executing the 2 worthless tests in all the
object scattered around the universe that Rocket could theoretically
optimize.

cds


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-20 Thread Wjhonson
You just want all the jobs to yourself :)



-Original Message-
From: Symeon Breen syme...@gmail.com
To: 'U2 Users List' u2-users@listserver.u2ug.org
Sent: Fri, Apr 20, 2012 1:45 am
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


Both read exactly the same to me - the case probably takes a bit longer to
igest cos there is more text to read, but there is not much in it. - come
n guys if you have to think about any of these then perhaps you need to
hange career ?


-Original Message-
rom: u2-users-boun...@listserver.u2ug.org
mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
ent: 19 April 2012 22:42
o: U2 Users List
ubject: Re: [U2] Case Statement with only two cases... or for that
atter... one case
The initial example was close to a good start... something like...
If XX then gosub YY  else  gosub ZZ
Replaced by
Begin case
  Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case
Except that now... note that readability is enhanced by [1] indenting... so
s to align text and [2] using mixed-case and camelCase typography.
--Bill

Original Message-
rom: u2-users-boun...@listserver.u2ug.org
mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
ent: Thursday, April 19, 2012 5:33 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] Case Statement with only two cases... or for that
atter... one case
Give an example of, with what you would replace the If Then Else

__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

o virus found in this message.
hecked by AVG - www.avg.com
ersion: 10.0.1424 / Virus Database: 2411/4946 - Release Date: 04/19/12
___
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-20 Thread Wjhonson

I wouldn't say that's an extra worthless test.
I think what it is telling us is that CASE 1 does not mean otherwise in a 
traditional sense.
It really does mean IF @TRUE or IF 1=1

Which is a bit suprising that the compiler would have been written that way, 
but it does make a kind of sense.



-Original Message-
From: Charles Stevenson stevenson.c...@gmail.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Fri, Apr 20, 2012 6:28 am
Subject: Re: [U2] Case Statement with only two cases


A respectful correction, Brian.
On 4/20/2012 4:50 AM, Brian Leach wrote:
 it's all the same to the compiler.
 -Original Message-
 BEGIN CASE
CASE A = TEST; GOSUB DO.SOMETHING
CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE
 versus this
 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Since we seem to be finding every nit in the bottom of this empty 
arrel, here's one more.
here are 2 compiler difference as shown by VLIST (UV10.2):
1: BEGIN CASE
2:CASE A = TEST; GOSUB DO.SOMETHING
0002 0 : 06E eq A TEST  = $R0
0002 8 : 2DE testfw $R0 00020:
0002 00010 : 0A4 gosub  00060:

0003:CASE 1; GOSUB DO.SOMETHING.ELSE
0003 00018 : 0C2 jump   00038:
0003 00020 : 2DE testfw 1 00038: -- Extra 
orthless test
0003 00028 : 0A4 gosub  00062:
4: END CASE
0004 00030 : 0C2 jump   00038: -- Extra worthless 
ump (to next line)
  
Source lineup is goofy.  This jump is really part

   of source line 3.   RAID is confusing, too.
   A 
iscussion for a different thread.)
5: IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
0005 00038 : 06E eq A TEST  = $R0
0005 00040 : 2DE testfw $R0 00058:
0005 00048 : 0A4 gosub  00060:
0005 00050 : 0C2 jump   00060:
0005 00058 : 0A4 gosub  00062:
6: STOP
0006 00060 : 190 stop

ith the speed of today's machines it would be hard to find a place 
here that performance makes a difference.
Rocket could theoretically clean up both (or either independently) if 
he compiler was smart enough:
1. to know that a logical test outcome was predestined at compile time 
It already does that sort of thing in other situations.).  Then it 
ould  compile only 1 of the 2 paths the testfw takes.  (e.g. 0020x).  
ame for IF,  WHILE, or UNTIL constructs.
2. To recognize the final CASE before the END CASE never needs to jump 
e.g., 0030x).
I wonder if we've already wasted more electrical  biological energy by 
e writing this email, dispersing it around the globe, and you reading 
t, than all the machine cycles wasted executing the 2 worthless tests 
n all the object scattered around the universe that Rocket could 
heoretically optimize.
cds

__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-20 Thread Kate Stanton
Rather than:

BEGIN CASE
  CASE A = TEST; GOSUB DO.SOMETHING
  CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

or

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

I prefer:

IF A = TEST THEN GOSUB DO.SOMETHING ;* Say why
ELSE  GOSUB DO.SOMETHING.ELSE  ;* The reason

lining up the GOSUBs under each other, with comment making it clear why.
-- 
Kate Stanton
Walstan Systems Ltd
4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand
Phone: + 64 9 360 5310  Mobile: + 64 21 400 486
Email: k...@walstan.com
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-19 Thread Bill Haskett
Sometimes I build a case statement like this because I figure I'll grow 
into it by the time I'm done doing what I'm trying to do.  :-)


Bill


- Original Message -
*From:* wjhon...@aol.com
*To:* u2-users@listserver.u2ug.org
*Date:* 4/19/2012 12:52 PM
*Subject:* [U2] Case Statement with only two cases

Is there a point in code like this

BEGIN CASE
CASE A = TEST; GOSUB DO.SOMETHING
CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-19 Thread Dave Laansma
Logically they are clearly the same. It just depends on what the
programmer had in mind for the future of 'A'.

Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
Delivering Products, Services and Innovative Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-19 Thread George Gallen
Or if your re-using code, and you don't need all the cases in one program.

George

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Colwell, Kim
Sent: Thursday, April 19, 2012 3:56 PM
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases

Makes FUTURE maintenance MUCH easier if you want to add 1 or 2 or 5 more
cases 

On Thu, Apr 19, 2012 at 2:52 PM, Wjhonson wjhon...@aol.com wrote:


 Is there a point in code like this

 BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
 END CASE

 versus this

 IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

 Personally I see no advantage in making this a  CASE

 Does the rest of the *Universe* agree with me?
 ___
 U2-Users mailing list
 U2-Users@listserver.u2ug.org
 http://listserver.u2ug.org/mailman/listinfo/u2-users




-- 
Kim Colwell
x769
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases

2012-04-19 Thread Sammartino, Richard
The case statement can be faster if you put the condition with the most 
occurrences first. As soon as the 'true' condition is met, the program exits 
the case statement.  The if-then-else construct took longer to evaluate.  When 
processors were slow, there were gains to be had.

Richard Sammartino
- Original Message -
From: Wjhonson wjhon...@aol.com
To: u2-users@listserver.u2ug.org
Sent: Thursday, April 19, 2012 3:52:21 PM
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Bill Brutzman
The case statement has a huge advantage in what really matters... human 
readability... that is the point.

From readability follows... reliability, maintainability, and testability... 
better, cleaner, safer software.

An irony is that while the if statement...  is the cornerstone of all 
computing... the if is also a problematic and mostly obsolete construct.

--Bill

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 3:52 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Case Statement with only two cases


Is there a point in code like this

BEGIN CASE
   CASE A = TEST; GOSUB DO.SOMETHING
   CASE 1; GOSUB DO.SOMETHING.ELSE
END CASE

versus this

IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE

Personally I see no advantage in making this a  CASE

Does the rest of the *Universe* agree with me?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Wjhonson

Explain more what you mean by saying the if is problematic and obsolete ?




-Original Message-
From: Bill Brutzman bi...@hkmetalcraft.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Apr 19, 2012 1:35 pm
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


The case statement has a huge advantage in what really matters... human 
eadability... that is the point.
From readability follows... reliability, maintainability, and testability... 
etter, cleaner, safer software.
An irony is that while the if statement...  is the cornerstone of all 
omputing... the if is also a problematic and mostly obsolete construct.
--Bill
-Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Thursday, April 19, 2012 3:52 PM
o: u2-users@listserver.u2ug.org
ubject: [U2] Case Statement with only two cases

s there a point in code like this
BEGIN CASE
  CASE A = TEST; GOSUB DO.SOMETHING
  CASE 1; GOSUB DO.SOMETHING.ELSE
ND CASE
versus this
IF A = TEST THEN GOSUB DO.SOMETHING ELSE GOSUB DO.SOMETHING.ELSE
Personally I see no advantage in making this a  CASE
Does the rest of the *Universe* agree with me?
__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users
__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Bill Brutzman
1.Problematic...  [a] I run into sloppy if statements often... it is sometimes 
difficult for me to infer what the programmer was trying to accomplish. 
 
I would like to see

If XX then
Gosub YY

End else
Gosub ZZ
End

I often see shortcuts and fragmented if statements.

Some languages require a semicolon to specify the end 
of a line.  Some languages use curly braces to specify the beginning and end of 
say a function

[b] This problem gets exacerbated with nested if statements.

2. Obsolete... I look forward to the day when programmers start to realize 
that... for the reasons cited... and others... that IF statements are bad 
programming practice perhaps one notch above the goto statement.

--Bill


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 4:57 PM
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


Explain more what you mean by saying the if is problematic and obsolete ?



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Wjhonson
Give an example of, with what you would replace the If Then Else



-Original Message-
From: Bill Brutzman bi...@hkmetalcraft.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Apr 19, 2012 2:26 pm
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


1.Problematic...  [a] I run into sloppy if statements often... it is sometimes 
ifficult for me to infer what the programmer was trying to accomplish. 

I would like to see
If XX then
   Gosub YY 

End else
   Gosub ZZ
End
I often see shortcuts and fragmented if statements.
Some languages require a semicolon to specify the end 
of a line.  Some 
anguages use curly braces to specify the beginning and end of say a function
[b] This problem gets exacerbated with nested if statements.
2. Obsolete... I look forward to the day when programmers start to realize 
hat... for the reasons cited... and others... that IF statements are bad 
rogramming practice perhaps one notch above the goto statement.
--Bill

Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Thursday, April 19, 2012 4:57 PM
ubject: Re: [U2] Case Statement with only two cases... or for that matter... 
ne case

xplain more what you mean by saying the if is problematic and obsolete ?

___
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Bill Brutzman
The initial example was close to a good start... something like...

If XX then gosub YY  else  gosub ZZ

Replaced by

Begin case
   Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case

Except that now... note that readability is enhanced by [1] indenting... so as 
to align text and [2] using mixed-case and camelCase typography.

--Bill
 
-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 5:33 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case

Give an example of, with what you would replace the If Then Else


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread George Gallen
That's like saying that Mercury's are being replaced by Ford's.same 
difference

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
Sent: Thursday, April 19, 2012 5:42 PM
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case

The initial example was close to a good start... something like...

If XX then gosub YY  else  gosub ZZ

Replaced by

Begin case
   Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case

Except that now... note that readability is enhanced by [1] indenting... so as 
to align text and [2] using mixed-case and camelCase typography.

--Bill
 
-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 5:33 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case

Give an example of, with what you would replace the If Then Else


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Danny Ruckel
I don't agree that readability is improved when you use mixed case in your
Case (or case) statement...


Danny



-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
Sent: Thursday, April 19, 2012 2:42 PM
To: U2 Users List
Subject: Re: [U2] Case Statement with only two cases... or for that
matter... one case

The initial example was close to a good start... something like...

If XX then gosub YY  else  gosub ZZ

Replaced by

Begin case
   Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case

Except that now... note that readability is enhanced by [1] indenting... so
as to align text and [2] using mixed-case and camelCase typography.

--Bill
 
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 5:33 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Case Statement with only two cases... or for that
matter... one case

Give an example of, with what you would replace the If Then Else


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread dennis bartlett
Well, I wrote a proggie to process source code and break long IF/THEN/ELSE
into
IF   ... THEN
END ELSE
END

and also

SEL.VERB = 'SELECT FILE WITH J=1 AND K=2 AND L=3 BY ABC BY DEF BREAK-ON XYZ
TO

SEL.VERB = ''
SEL.VERB := SELECT FILE
SEL.VERB :=  WITH J=1 AND
SEL.VERB :=  K=2 AND
SEL.VERB :=  L=3
SEL.VERB :=  BY ABC BY DEF
SEL.VERB :=  BREAK-ON XYZ
SEL.VERB := etc

It does a few other personal likes

It's just a matter of choice - having been a maintenance contractor for
years I just like code that can easily be read within the 80 x 24 telnet
client

As for the mixed case thing, that has roared on forever, but it interesting
to note that many internal Universe progs are written in mixed case.
It all depends on the site, but mixed case requires dragonian standards
rules, which are too much of a bother...


On 20 April 2012 07:59, Danny Ruckel dan...@southwesttraders.com wrote:

 I don't agree that readability is improved when you use mixed case in your
 Case (or case) statement...


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Wjhonson
I don't understand why you'd want this


SEL.VERB = 'SELECT FILE WITH J=1 AND K=2 AND L=3 BY ABC BY DEF BREAK-ON XYZ
O
SEL.VERB = ''
EL.VERB := SELECT FILE
EL.VERB :=  WITH J=1 AND
EL.VERB :=  K=2 AND
EL.VERB :=  L=3
EL.VERB :=  BY ABC BY DEF
EL.VERB :=  BREAK-ON XYZ
EL.VERB := etc





-Original Message-
From: dennis bartlett dqbartl...@gmail.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Apr 19, 2012 4:45 pm
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


Well, I wrote a proggie to process source code and break long IF/THEN/ELSE
nto
F   ... THEN
ND ELSE
ND
and also
SEL.VERB = 'SELECT FILE WITH J=1 AND K=2 AND L=3 BY ABC BY DEF BREAK-ON XYZ
O
SEL.VERB = ''
EL.VERB := SELECT FILE
EL.VERB :=  WITH J=1 AND
EL.VERB :=  K=2 AND
EL.VERB :=  L=3
EL.VERB :=  BY ABC BY DEF
EL.VERB :=  BREAK-ON XYZ
EL.VERB := etc
It does a few other personal likes
It's just a matter of choice - having been a maintenance contractor for
ears I just like code that can easily be read within the 80 x 24 telnet
lient
As for the mixed case thing, that has roared on forever, but it interesting
o note that many internal Universe progs are written in mixed case.
t all depends on the site, but mixed case requires dragonian standards
ules, which are too much of a bother...

n 20 April 2012 07:59, Danny Ruckel dan...@southwesttraders.com wrote:
 I don't agree that readability is improved when you use mixed case in your
 Case (or case) statement...


__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement with only two cases... or for that matter... one case

2012-04-19 Thread Wjhonson

You replace one line with four lines
I'm an atheist regarding the belief in code bloat



-Original Message-
From: Bill Brutzman bi...@hkmetalcraft.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Thu, Apr 19, 2012 4:48 pm
Subject: Re: [U2] Case Statement with only two cases... or for that matter... 
one case


The initial example was close to a good start... something like...
If XX then gosub YY  else  gosub ZZ
Replaced by
Begin case
  Case XX  ;  gosub YY
   Case 1 ;  gosub ZZ
End   case
Except that now... note that readability is enhanced by [1] indenting... so as 
o align text and [2] using mixed-case and camelCase typography.
--Bill

Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Thursday, April 19, 2012 5:33 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] Case Statement with only two cases... or for that matter... 
ne case
Give an example of, with what you would replace the If Then Else

__
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Case Statement

2012-04-19 Thread Bill Brutzman
In many areas of life, including writing code, less is more.

Less code in this case is... more dog work.

Framing the case statement as bloat, for me, is a mischaracterization... 
usually it is the cat that is bloated.

In this case, I like to think that I have seen the light... 

--Bill

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, April 19, 2012 7:50 PM
Subject: Re: [U2] Case Statement 

Replacing one line with four lines...


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users