Re: [U2] What is true

2013-08-02 Thread Kevin King
Or as we say it here: "The way you write code today will determine the
words used to describe you six months from now".


On Fri, Aug 2, 2013 at 10:00 AM, Wjhonson  wrote:

> To me the purpose is that
> --  it helps when reading the code
>
> If more effort is spent on the next programmer
> understanding what your code is doing
> that is time well worth spent
>
>
>
>
>
>
>
> -Original Message-
> From: Martin Phillips 
> To: 'U2 Users List' 
> Sent: Thu, Aug 1, 2013 11:16 am
> Subject: Re: [U2] What is true
>
>
> Hi again,
>
> I have been on a site where they insisted that
>A = B = C
> should be written as
>A = B EQ C
> to emphasise that the second operator is a relational test.
>
> Personally, I use
>A = (B = C)
> even though the brackets serve no purpose. It just helps when reading the
> code.
>
>
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
>
> ___
> 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] What is true

2013-08-02 Thread Wjhonson
To me the purpose is that
--  it helps when reading the code

If more effort is spent on the next programmer
understanding what your code is doing
that is time well worth spent

 

 

 

-Original Message-
From: Martin Phillips 
To: 'U2 Users List' 
Sent: Thu, Aug 1, 2013 11:16 am
Subject: Re: [U2] What is true


Hi again,

I have been on a site where they insisted that
   A = B = C
should be written as
   A = B EQ C
to emphasise that the second operator is a relational test.

Personally, I use
   A = (B = C)
even though the brackets serve no purpose. It just helps when reading the code.


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

___
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] What is true

2013-08-01 Thread Kevin King
Martin, that's actually one of my standards.  Due to the ambiguity of
several characters, most notably <, >, and =, we use EQ, NE, LT, LE, GT,
and GE for comparison and use <> for array extraction and replacement and =
for assignment.  Except in SB+, which doesn't allow such critters.  And
kudos for the characters that serve no purpose!  Personally, I prefer the
readability of:

IF (VAR1 GT VAR2) THEN

vs.

IF VAR1>VAR2 THEN

but then again, that's just one perspective.



On Thu, Aug 1, 2013 at 12:15 PM, Martin Phillips <
martinphill...@ladybridge.com> wrote:

> Hi again,
>
> I have been on a site where they insisted that
>A = B = C
> should be written as
>A = B EQ C
> to emphasise that the second operator is a relational test.
>
> Personally, I use
>A = (B = C)
> even though the brackets serve no purpose. It just helps when reading the
> code.
>
>
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
>
> ___
> 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] What is true

2013-08-01 Thread Sammartino, Richard
To further complicate things, I was instructed at one job to use the IF VAR 
THEN syntax as this was treated a boolean operation and executed faster than IF 
VAR # ''.  We were working on Prime Information at the time.  A few years later 
I went to work for a VAR.  I had made changes to the their programs at a 
customer site and used the IF VAR THEN construct. The code failed in testing.  
This was on an ADDS Mentor.  I went back to the office and wrote a 3 line 
program of:
 
VAR = 'ABC'
IF VAR THEN CRT 'TRUE' ELSE CRT 'FALSE'
END

I got TRUE on the Prime box and FALSE on the ADDS.  I wound up looking at a 
co-workers copy of THE PICK POCKET GUIDE. There is a chapter titled IN SEARCH 
OF THE TRUTH. It explained in detail how different PICK systems determine true 
or false. It did not explain the Prime implementation but was very helpful. I 
changed my code to read IF VAR # '' THEN and my problem went away.

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


Re: [U2] What is true

2013-08-01 Thread Daniel McGrath
I agree the implementation can be better, although for different reasons. In 
the INFORMATION way, it allows you to have silent run-time errors when people 
mistakenly use file handles in place of variables with similar names. At least 
in the UniVerse model you get a run-time error during testing, instead of 
silently testing if CLIENT EQ "" instead of CLIENT.REC EQ "".

Where I think the implementation could be better, is that the compiler issues 
an warning about a possible misuse of the file handle as a regular variable. If 
has enough information to determine if at least a warning can be issue, 
although a hard compile time error doesn't work, as people my be using that 
same variable name for different purposes in other areas of the code.

We are working on some changes to the language in UniVerse 11.2 that will make 
implementing more effective static analysis like I propose above easier.

Cheers,
Dan

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists
Sent: Thursday, August 01, 2013 12:48 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] What is true

On 01/08/13 17:10, Ed Clark wrote:
> on universe, it looks like only fileinfo(var,0) will let you test. 
> fileinfo(var,1) etc will abort complaining that var isn't a file 
> variable
> 
Which is why I think the UV implementation is CRAP!

You should not be able to *crash* your program simply by accessing a variable. 
And if a statement makes - under ALL circumstances - complete logical sense. 
like "IF VAR EQ "" THEN", it should not be a crapshoot whether your program 
crashes depending on the content of VAR.

INFORMATION got this right - you might not be able to mess about with a file 
variable inside BASIC, but at least you could do anything you wanted that made 
sense.

Cheers,
Wol
___
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] What is true

2013-08-01 Thread Wols Lists
On 01/08/13 19:15, Martin Phillips wrote:
> Hi again,
> 
> I have been on a site where they insisted that
>A = B = C
> should be written as
>A = B EQ C
> to emphasise that the second operator is a relational test.
> 
A lot of fellow coders have wondered at it, but as someone who learnt
coding in FORTRAN, I *always* use EQ, NE, LT, GT etc as my logical
operators.

Okay, I had to be careful reading other people's code, but if there was
a logical "=" in my code it was a mistake!!!

Cheers,
Wol


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


Re: [U2] What is true

2013-08-01 Thread Wols Lists
On 01/08/13 17:10, Ed Clark wrote:
> on universe, it looks like only fileinfo(var,0) will let you test. 
> fileinfo(var,1) etc will abort complaining that var isn't a file variable
> 
Which is why I think the UV implementation is CRAP!

You should not be able to *crash* your program simply by accessing a
variable. And if a statement makes - under ALL circumstances - complete
logical sense. like "IF VAR EQ "" THEN", it should not be a crapshoot
whether your program crashes depending on the content of VAR.

INFORMATION got this right - you might not be able to mess about with a
file variable inside BASIC, but at least you could do anything you
wanted that made sense.

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


Re: [U2] What is true

2013-08-01 Thread Martin Phillips
Hi again,

I have been on a site where they insisted that
   A = B = C
should be written as
   A = B EQ C
to emphasise that the second operator is a relational test.

Personally, I use
   A = (B = C)
even though the brackets serve no purpose. It just helps when reading the code.


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

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


Re: [U2] What is true

2013-08-01 Thread Tony Gravagno
You're right. X is never 3, but I did say so. As I said below, that's
the way it works in languages other than BASIC. X=Y=3 will set both
values to 3 because of the order of operations.

And I was wrong when I said we Need to force precedence. It doesn't
Need to be forced in BASIC, but in other languages it does. In BASIC,
without the parentheses each developer will be left to wonder or just
know from experience that BASIC is different from other languages. The
parentheses in this case provide clarity and "force precedence" for
anyone coming to BASIC from the outside world. Hehe, but we know that
never happens...

Thanks.
T
Last time I agree with Brian on anything... ;)


> From: Jim Swain 
> Now I'm getting confused... its not a case of precedence
> 
> In the case of X = Y = 3
> 
> X is set to 1 (true) when Y = 3
> X is set to 0 (false) when Y # 3
> 
> X in this instance will never = 3
> 
> From: Tony Gravagno

> Just adding a little more subtlety. Consider:
> X = Y = 3
> In some languages this sets Y to 3 and then X to Y, so X=3. But in
BASIC,
> as Brian said, we need to force the precedence on Y=3 before X=Y.

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


Re: [U2] What is true

2013-08-01 Thread Brian Leach
At T said that's in other languages (notably C style languages where = is
always assignment and == or === is equality/equivalence). In Pascal and
Delphi := is assignment, which gets confusing when you have three windows
open, one with UniVerse Basic, one with Delphi and one with C# or
JavaScript, and you're writing end-to-end code !

In MultiValue code = always binds to a LHS value as an assignment, and
otherwise as an equality.

So yes, X = Y = 3 is the same as X = (Y = 3)

But the parentheses make it clearer and do force precedence though in your
example the resulting ordering actually works out to be the same as the
original (it still forces an expression jump in a compiler). 

Consider:

X = X + Y = 3

You'd want to know whether you mean:

X = (X + Y) = 3
Or
X = X + (Y = 3)

Brian


-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jim Swain
Sent: 01 August 2013 17:46
To: U2 Users List
Subject: Re: [U2] What is true

Now I'm getting confused... its not a case of precedence

In the case of X = Y = 3

X is set to 1 (true) when Y = 3
X is set to 0 (false) when Y # 3

X in this instance will never = 3




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to
whom it is addressed. If you are not that person you are not permitted to
make use of the information and you are requested to notify us immediately
that you have received it and then destroy the copy in your possession.
Zafire Group may monitor outgoing and incoming e-mails.  By replying to this
e-mail you consent to such monitoring.  This e-mail message and any attached
files have been scanned for the presence of computer viruses. However, you
are advised that you open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and
Wales. Co. Reg. No. 3968255. Our registered address is Zafire House, Manor
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire
Aviation Software Limited is a limited liability company registered in
England and Wales. Co. Reg. No. 05577742. Our registered address is Zafire
House, Manor Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno
Sent: 01 August 2013 17:34
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] What is true

Just adding a little more subtlety. Consider:
X = Y = 3
In some languages this sets Y to 3 and then X to Y, so X=3. But in BASIC, as
Brian said, we need to force the precedence on Y=3 before X=Y.

In other contexts, parentheses force an equation. Consider:
SUBROUTINE FOO( X,Y,Z )
and
CALL FOO( X,Y,(Z) )
In this case, X and Y can be set and returned. But the third argument is an
equation, and while FOO can write to the variable in its own context, when
the data comes back it's read-only, since what went out was not a variable
but the result of the evaluation of an equation.

(X) does nothing to define the Boolean nature of a variable. While it's a
nice visual cue it's not "functional" in the code.

T



> From: Brian Leach
> It's not the parentheses that define the Boolean, it's the equality
by
> the way. Parentheses just force the precedence.


> From: Jim Swain
> This is not true as when A='HELLO'  IF (A) returns true.
>
> You use the parenthesis to set a Boolean variable, i.e  BRITISH =
> (COUNTRY = 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is
set to 1
> when the conditions inside the parenthesis are met, otherwise
BRITISH is set to 0


> From: Tom Whitmore
> If you wrap a variable in parenthesis it will be treated as a
Boolean test.
> For example:
> A='HELLO'
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

___
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] What is true

2013-08-01 Thread Brian Leach
Which is why I used it in my response.

Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ed Clark
Sent: 01 August 2013 17:10
To: U2 Users List
Subject: Re: [U2] What is true

on universe, it looks like only fileinfo(var,0) will let you test.
fileinfo(var,1) etc will abort complaining that var isn't a file variable

On Aug 1, 2013, at 9:52 AM, "Martin Phillips"
 wrote:

>> on universe (not sure of unidata), you can use FILEINFO() to see if
something is a file variable:
>> 
>> x=""
>> crt fileinfo(x,0)
>> 
>> returns 0. Would return 1 for an open file.
> 
> This originated in Prime Information and is available on UniVerse,
UniData, PI/open, QM, and probably a few others.
> 
> 
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
> 
> 
> 
> 
> ___
> 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] What is true

2013-08-01 Thread Jim Swain
Now I'm getting confused... its not a case of precedence

In the case of X = Y = 3

X is set to 1 (true) when Y = 3
X is set to 0 (false) when Y # 3

X in this instance will never = 3




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to whom 
it is addressed. If you are not that person you are not permitted to make use 
of the information and you are requested to notify us immediately that you have 
received it and then destroy the copy in your possession.  Zafire Group may 
monitor outgoing and incoming e-mails.  By replying to this e-mail you consent 
to such monitoring.  This e-mail message and any attached files have been 
scanned for the presence of computer viruses. However, you are advised that you 
open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and Wales. 
Co. Reg. No. 3968255. Our registered address is Zafire House, Manor Park, 
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
Software Limited is a limited liability company registered in England and 
Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact 
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno
Sent: 01 August 2013 17:34
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] What is true

Just adding a little more subtlety. Consider:
X = Y = 3
In some languages this sets Y to 3 and then X to Y, so X=3. But in BASIC, as 
Brian said, we need to force the precedence on Y=3 before X=Y.

In other contexts, parentheses force an equation. Consider:
SUBROUTINE FOO( X,Y,Z )
and
CALL FOO( X,Y,(Z) )
In this case, X and Y can be set and returned. But the third argument is an 
equation, and while FOO can write to the variable in its own context, when the 
data comes back it's read-only, since what went out was not a variable but the 
result of the evaluation of an equation.

(X) does nothing to define the Boolean nature of a variable. While it's a nice 
visual cue it's not "functional" in the code.

T



> From: Brian Leach
> It's not the parentheses that define the Boolean, it's the equality
by
> the way. Parentheses just force the precedence.


> From: Jim Swain
> This is not true as when A='HELLO'  IF (A) returns true.
>
> You use the parenthesis to set a Boolean variable, i.e  BRITISH =
> (COUNTRY = 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is
set to 1
> when the conditions inside the parenthesis are met, otherwise
BRITISH is set to 0


> From: Tom Whitmore
> If you wrap a variable in parenthesis it will be treated as a
Boolean test.
> For example:
> A='HELLO'
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

___
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] What is true

2013-08-01 Thread Tony Gravagno
Just adding a little more subtlety. Consider:
X = Y = 3 
In some languages this sets Y to 3 and then X to Y, so X=3. But in
BASIC, as Brian said, we need to force the precedence on Y=3 before
X=Y.

In other contexts, parentheses force an equation. Consider:
SUBROUTINE FOO( X,Y,Z )
and
CALL FOO( X,Y,(Z) )
In this case, X and Y can be set and returned. But the third argument
is an equation, and while FOO can write to the variable in its own
context, when the data comes back it's read-only, since what went out
was not a variable but the result of the evaluation of an equation.

(X) does nothing to define the Boolean nature of a variable. While
it's a nice visual cue it's not "functional" in the code.

T



> From: Brian Leach 
> It's not the parentheses that define the Boolean, it's the equality
by
> the way. Parentheses just force the precedence.


> From: Jim Swain 
> This is not true as when A='HELLO'  IF (A) returns true.
> 
> You use the parenthesis to set a Boolean variable, i.e  BRITISH =
> (COUNTRY = 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is
set to 1
> when the conditions inside the parenthesis are met, otherwise
BRITISH is set to 0


> From: Tom Whitmore 
> If you wrap a variable in parenthesis it will be treated as a
Boolean test.
> For example:
> A='HELLO'
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

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


Re: [U2] What is true

2013-08-01 Thread Tony Gravagno
Fascinating stuff. :)
I don't like the idea of spaces being numeric but when I get data from
unknown sources I do tend to TRIM and test for NUM(x).

With the following program:
- Universe in Information flavor reports True on all tests.
- Unidata only reports 3-8 as True
- D3 does not consider any of the tests as True, and flags
5,6,8,9,11,12 as non-numeric

This is obviously not consistent across all platforms/flavors.

X = 1
IF "  3" = 3 THEN CRT "T1"
IF "  ":X = X THEN CRT "T2"
Y = "TEST"
IF Y THEN CRT "T3"
IF (Y) THEN CRT "T4"
Z = " "
IF Z THEN CRT "T5"
IF (Z) THEN CRT "T6"
Z = Z:2
IF Z THEN CRT "T7"
IF (Z) THEN CRT "T8"
END


> From:  Martin Phillips 
> Not odd at all. The language defines the relational operators as
> performing a numeric comparison if both items being compared are
> numbers or can be treated as numbers.
> 
> It is valid for a numeric string to include leading or trailing
spaces.

 
> From: Ed Clark 
> A curious feature of true and false on universe:
> 
> 0001 x=char(32)
> 0002 if x=0 then crt 'is zero' else crt 'not zero'
> 0003 if x then crt 'true' else crt 'false'
> 0004 x:=0
> 0005 if x=0 then crt 'is zero' else crt 'not zero'
> 0006 if x then crt 'true' else crt 'false'
> 
> space is true, but space:zero is false.

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


Re: [U2] What is true

2013-08-01 Thread Ed Clark
on universe, it looks like only fileinfo(var,0) will let you test. 
fileinfo(var,1) etc will abort complaining that var isn't a file variable

On Aug 1, 2013, at 9:52 AM, "Martin Phillips"  
wrote:

>> on universe (not sure of unidata), you can use FILEINFO() to see if 
>> something is a file variable:
>> 
>> x=""
>> crt fileinfo(x,0)
>> 
>> returns 0. Would return 1 for an open file.
> 
> This originated in Prime Information and is available on UniVerse, UniData, 
> PI/open, QM, and probably a few others.
> 
> 
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
> 
> 
> 
> 
> ___
> 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] What is true

2013-08-01 Thread Ed Clark
but only on universe. On unidata and other platforms, space:0 is not zero and 
not numeric, and is true


On Aug 1, 2013, at 9:49 AM, "Martin Phillips"  
wrote:

> Not odd at all. The language defines the relational operators as performing a 
> numeric comparison if both items being compared are
> numbers or can be treated as numbers.
> 
> It is valid for a numeric string to include leading or trailing spaces.
> 
> 
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
> 
> 
> 
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ed Clark
> Sent: 01 August 2013 14:41
> To: U2 Users List
> Subject: Re: [U2] What is true
> 
> Do people from Wales take well to being called British? Sadly, almost 
> everything I know about Wales comes from watching "Torchwood"
> and "Gavin and Stacy"
> 
> A curious feature of true and false on universe:
> 
> 0001 x=char(32)
> 0002 if x=0 then crt 'is zero' else crt 'not zero'
> 0003 if x then crt 'true' else crt 'false'
> 0004 x:=0
> 0005 if x=0 then crt 'is zero' else crt 'not zero'
> 0006 if x then crt 'true' else crt 'false'
> 
> space is true, but space:zero is false.
> 
> 
> On Aug 1, 2013, at 8:24 AM, Jim Swain  wrote:
> 
>> This is not true as when A='HELLO'  IF (A) returns true.
>> 
>> You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
>> 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var
> BRITISH is set to 1 when the conditions inside the parenthesis are met, 
> otherwise BRITISH is set to 0
>> 
>> 
>> 
>> 
>> Jim Swain - Developer
>> Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819
>> 
>> www.zafire.com
>> 
>> Consider the environment.  Think before you print.
>> 
>> This is a commercial communication from Zafire Group.
>> This communication is confidential and is intended only for the person to 
>> whom it is addressed. If you are not that person you are
> not permitted to make use of the information and you are requested to notify 
> us immediately that you have received it and then
> destroy the copy in your possession.  Zafire Group may monitor outgoing and 
> incoming e-mails.  By replying to this e-mail you
> consent to such monitoring.  This e-mail message and any attached files have 
> been scanned for the presence of computer viruses.
> However, you are advised that you open attachments at your own risk.
>> 
>> Zafire Limited is a limited liability company registered in England and 
>> Wales. Co. Reg. No. 3968255. Our registered address is
> Zafire House, Manor Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 
> 55. Zafire Aviation Software Limited is a limited
> liability company registered in England and Wales. Co. Reg. No. 05577742. Our 
> registered address is Zafire House, Manor Park,
> Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70
>> 
>> If you have any concerns regarding the content of this e-mail please contact 
>> postmas...@zafire.com
>> 
>> -Original Message-
>> From: u2-users-boun...@listserver.u2ug.org 
>> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
>> Sent: 01 August 2013 13:17
>> To: U2 Users List
>> Subject: Re: [U2] What is true
>> 
>> Hi,
>> To add a little more to the discussion.  I know in UniVerse this is true and 
>> I suspect it is true in other flavors of Pick.
>> 
>> If you wrap a variable in parenthesis it will be treated as a Boolean test.  
>> For example:
>> 
>> A=''
>> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
>> A=0
>> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
>> A='HELLO'
>> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
>> A=1
>> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
>> 
>> I have found this useful in coding.
>> 
>> Tom Whitmore
>> RATEX Business Solutions
>> 
>> -Original Message-
>> From: u2-users-boun...@listserver.u2ug.org 
>> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
>> Sent: Thursday, August 01, 2013 4:40 AM
>> To: 'U2 Users List'
>> Subject: Re: [U2] What 

Re: [U2] What is true

2013-08-01 Thread Martin Braid
Identical on UDNT  7.1.20



-
Epicor Software (UK) is a limited company registered in England & Wales.
Registration Number: 2338274.   Registered Office:  6th Floor, One London Wall, 
London EC2Y 5EB
This e-mail and any attachments to it are confidential and is for the use of 
the intended recipient(s) only. If you have received this e-mail in error, 
please notify the sender immediately and then delete it. If you are not the 
intended recipient, you must not use, disclose or distribute this e-mail 
without the author's prior permission. We have taken precautions to minimize 
the risk of transmitting software viruses, but we advise you to carry out your 
own virus checks on any attachment to this message. We cannot accept liability 
for any loss or damage caused by software viruses. Any views and/or opinions 
expressed in this e-mail are of the author only and do not represent the views 
of Epicor Software (UK) Limited or any other company within its group.
-

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 15:52
To: U2 Users List
Subject: Re: [U2] What is true

Here is a simple program I wrote and ran on UV 11.1.9.  It would be interesting 
to hear if UD behaves the same way.

0001: A=''
0002: CRT 'A = ':QUOTE(A):' ':
0003: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0004: A=0
0005: CRT 'A = ':QUOTE(A):' ':
0006: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0007: A='HELLO'
0008: CRT 'A = ':QUOTE(A):' ':
0009: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0010: A=1
0011: CRT 'A = ':QUOTE(A):' ':
0012: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'

The results are:
 A = "" FALSE
 A = "0" FALSE
 A = "HELLO" TRUE
 A = "1" TRUE

Tom Whitmore
RATEX Business Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jim Swain
Sent: Thursday, August 01, 2013 8:24 AM
To: U2 Users List
Subject: Re: [U2] What is true

This is not true as when A='HELLO'  IF (A) returns true.

You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the 
conditions inside the parenthesis are met, otherwise BRITISH is set to 0




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to whom 
it is addressed. If you are not that person you are not permitted to make use 
of the information and you are requested to notify us immediately that you have 
received it and then destroy the copy in your possession.  Zafire Group may 
monitor outgoing and incoming e-mails.  By replying to this e-mail you consent 
to such monitoring.  This e-mail message and any attached files have been 
scanned for the presence of computer viruses. However, you are advised that you 
open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and Wales. 
Co. Reg. No. 3968255. Our registered address is Zafire House, Manor Park, 
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
Software Limited is a limited liability company registered in England and 
Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact 
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 13:17
To: U2 Users List
Subject: Re: [U2] What is true

Hi,
To add a little more to the discussion.  I know in UniVerse this is true and I 
suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.  
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Beha

Re: [U2] What is true

2013-08-01 Thread Tom Whitmore
Here is a simple program I wrote and ran on UV 11.1.9.  It would be interesting 
to hear if UD behaves the same way.

0001: A=''
0002: CRT 'A = ':QUOTE(A):' ':
0003: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0004: A=0
0005: CRT 'A = ':QUOTE(A):' ':
0006: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0007: A='HELLO'
0008: CRT 'A = ':QUOTE(A):' ':
0009: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'
0010: A=1
0011: CRT 'A = ':QUOTE(A):' ':
0012: IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'

The results are:
 A = "" FALSE
 A = "0" FALSE
 A = "HELLO" TRUE
 A = "1" TRUE

Tom Whitmore
RATEX Business Solutions


-----Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jim Swain
Sent: Thursday, August 01, 2013 8:24 AM
To: U2 Users List
Subject: Re: [U2] What is true

This is not true as when A='HELLO'  IF (A) returns true.

You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the 
conditions inside the parenthesis are met, otherwise BRITISH is set to 0




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to whom 
it is addressed. If you are not that person you are not permitted to make use 
of the information and you are requested to notify us immediately that you have 
received it and then destroy the copy in your possession.  Zafire Group may 
monitor outgoing and incoming e-mails.  By replying to this e-mail you consent 
to such monitoring.  This e-mail message and any attached files have been 
scanned for the presence of computer viruses. However, you are advised that you 
open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and Wales. 
Co. Reg. No. 3968255. Our registered address is Zafire House, Manor Park, 
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
Software Limited is a limited liability company registered in England and 
Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact 
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 13:17
To: U2 Users List
Subject: Re: [U2] What is true

Hi,
To add a little more to the discussion.  I know in UniVerse this is true and I 
suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.  
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
Sent: Thursday, August 01, 2013 4:40 AM
To: 'U2 Users List'
Subject: Re: [U2] What is true

To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1 (all 
bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on 
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


___
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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] What is true

2013-08-01 Thread Martin Phillips
> on universe (not sure of unidata), you can use FILEINFO() to see if something 
> is a file variable:
>
> x=""
> crt fileinfo(x,0)
>
> returns 0. Would return 1 for an open file.

This originated in Prime Information and is available on UniVerse, UniData, 
PI/open, QM, and probably a few others.


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




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


Re: [U2] What is true

2013-08-01 Thread Martin Phillips
Not odd at all. The language defines the relational operators as performing a 
numeric comparison if both items being compared are
numbers or can be treated as numbers.

It is valid for a numeric string to include leading or trailing spaces.


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



-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Ed Clark
Sent: 01 August 2013 14:41
To: U2 Users List
Subject: Re: [U2] What is true

Do people from Wales take well to being called British? Sadly, almost 
everything I know about Wales comes from watching "Torchwood"
and "Gavin and Stacy"

A curious feature of true and false on universe:

0001 x=char(32)
0002 if x=0 then crt 'is zero' else crt 'not zero'
0003 if x then crt 'true' else crt 'false'
0004 x:=0
0005 if x=0 then crt 'is zero' else crt 'not zero'
0006 if x then crt 'true' else crt 'false'

space is true, but space:zero is false.


On Aug 1, 2013, at 8:24 AM, Jim Swain  wrote:

> This is not true as when A='HELLO'  IF (A) returns true.
> 
> You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
> 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var
BRITISH is set to 1 when the conditions inside the parenthesis are met, 
otherwise BRITISH is set to 0
> 
> 
> 
> 
> Jim Swain - Developer
> Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819
> 
> www.zafire.com
> 
> Consider the environment.  Think before you print.
> 
> This is a commercial communication from Zafire Group.
> This communication is confidential and is intended only for the person to 
> whom it is addressed. If you are not that person you are
not permitted to make use of the information and you are requested to notify us 
immediately that you have received it and then
destroy the copy in your possession.  Zafire Group may monitor outgoing and 
incoming e-mails.  By replying to this e-mail you
consent to such monitoring.  This e-mail message and any attached files have 
been scanned for the presence of computer viruses.
However, you are advised that you open attachments at your own risk.
> 
> Zafire Limited is a limited liability company registered in England and 
> Wales. Co. Reg. No. 3968255. Our registered address is
Zafire House, Manor Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 
55. Zafire Aviation Software Limited is a limited
liability company registered in England and Wales. Co. Reg. No. 05577742. Our 
registered address is Zafire House, Manor Park,
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70
> 
> If you have any concerns regarding the content of this e-mail please contact 
> postmas...@zafire.com
> 
> -----Original Message-
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
> Sent: 01 August 2013 13:17
> To: U2 Users List
> Subject: Re: [U2] What is true
> 
> Hi,
> To add a little more to the discussion.  I know in UniVerse this is true and 
> I suspect it is true in other flavors of Pick.
> 
> If you wrap a variable in parenthesis it will be treated as a Boolean test.  
> For example:
> 
> A=''
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
> A=0
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
> A='HELLO'
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
> A=1
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
> 
> I have found this useful in coding.
> 
> Tom Whitmore
> RATEX Business Solutions
> 
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
> Sent: Thursday, August 01, 2013 4:40 AM
> To: 'U2 Users List'
> Subject: Re: [U2] What is true
> 
> To clarify
> 
> In multivalue, True is not False, where False is anything that is 'falsy'
> i.e. zero or empty.
> Obviously different than other languages, notably those where true is -1 (all 
> bits set on a signed integer).
> 
> So:
> 
> A = "HELLO"
> IF A THEN CRT A :" WORLD"
> 
> Gives HELLO WORLD
> 
> Regarding file variables, the best way to check for these being assigned on 
> UniVerse is to use FILEINFO().
> 
> If FileInfo(SomeUnassignedVariable, 0) Then
>   Crt "This is an open file variable"
> End Else
>   Crt "This isn't"
> End
> 
> Brian
> 
> 
> _

Re: [U2] What is true

2013-08-01 Thread Ed Clark
on universe (not sure of unidata), you can use FILEINFO() to see if something 
is a file variable:

x=""
crt fileinfo(x,0)

returns 0. Would return 1 for an open file.

On Jul 31, 2013, at 4:47 PM, Wols Lists  wrote:

> On 31/07/13 09:06, Martin Phillips wrote:
>> Of course, nothing is ever completely black and white. As multivalue Basic 
>> has developed, internal data types have gone beyond
>> simply numbers and strings. If I write
>>   IF FVAR THEN ...
>> where FVAR is a file variable, what do I expect this to do? The language 
>> definition does not tell us but most multivalue products
>> would give us a data type error of some sort because there is no rule for 
>> transforming a file variable to a Boolean value.
> 
> Actually, UV gives us a program crash (or certainly used to :-(
> 
> Which was a real bummer when porting programs from INFORMATION, seeing
> as before the CLOSE statement was introduced, doing FILEVAR="" was the
> *recommended* way to close a file!
> 
> So a fair chunk of PI code would be of the form "IF FILEVAR EQ "" THEN
> OPEN FILE".
> 
> Feed that code into UV and BOOM! If you were unlucky enough to test an
> open variable your program blew up!
> 
> Cheers,
> Wol
> ___
> 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] What is true

2013-08-01 Thread Ed Clark
Do people from Wales take well to being called British? Sadly, almost 
everything I know about Wales comes from watching "Torchwood" and "Gavin and 
Stacy"

A curious feature of true and false on universe:

0001 x=char(32)
0002 if x=0 then crt 'is zero' else crt 'not zero'
0003 if x then crt 'true' else crt 'false'
0004 x:=0
0005 if x=0 then crt 'is zero' else crt 'not zero'
0006 if x then crt 'true' else crt 'false'

space is true, but space:zero is false.


On Aug 1, 2013, at 8:24 AM, Jim Swain  wrote:

> This is not true as when A='HELLO'  IF (A) returns true.
> 
> You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
> 'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the 
> conditions inside the parenthesis are met, otherwise BRITISH is set to 0
> 
> 
> 
> 
> Jim Swain - Developer
> Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819
> 
> www.zafire.com
> 
> Consider the environment.  Think before you print.
> 
> This is a commercial communication from Zafire Group.
> This communication is confidential and is intended only for the person to 
> whom it is addressed. If you are not that person you are not permitted to 
> make use of the information and you are requested to notify us immediately 
> that you have received it and then destroy the copy in your possession.  
> Zafire Group may monitor outgoing and incoming e-mails.  By replying to this 
> e-mail you consent to such monitoring.  This e-mail message and any attached 
> files have been scanned for the presence of computer viruses. However, you 
> are advised that you open attachments at your own risk.
> 
> Zafire Limited is a limited liability company registered in England and 
> Wales. Co. Reg. No. 3968255. Our registered address is Zafire House, Manor 
> Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
> Software Limited is a limited liability company registered in England and 
> Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
> Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70
> 
> If you have any concerns regarding the content of this e-mail please contact 
> postmas...@zafire.com
> 
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
> Sent: 01 August 2013 13:17
> To: U2 Users List
> Subject: Re: [U2] What is true
> 
> Hi,
> To add a little more to the discussion.  I know in UniVerse this is true and 
> I suspect it is true in other flavors of Pick.
> 
> If you wrap a variable in parenthesis it will be treated as a Boolean test.  
> For example:
> 
> A=''
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
> A=0
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
> A='HELLO'
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
> A=1
> IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
> 
> I have found this useful in coding.
> 
> Tom Whitmore
> RATEX Business Solutions
> 
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org 
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
> Sent: Thursday, August 01, 2013 4:40 AM
> To: 'U2 Users List'
> Subject: Re: [U2] What is true
> 
> To clarify
> 
> In multivalue, True is not False, where False is anything that is 'falsy'
> i.e. zero or empty.
> Obviously different than other languages, notably those where true is -1 (all 
> bits set on a signed integer).
> 
> So:
> 
> A = "HELLO"
> IF A THEN CRT A :" WORLD"
> 
> Gives HELLO WORLD
> 
> Regarding file variables, the best way to check for these being assigned on 
> UniVerse is to use FILEINFO().
> 
> If FileInfo(SomeUnassignedVariable, 0) Then
>   Crt "This is an open file variable"
> End Else
>   Crt "This isn't"
> End
> 
> Brian
> 
> 
> ___
> 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

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


Re: [U2] What is true

2013-08-01 Thread Brian Leach
Haha - so Scotland is already independent then ...



It's not the parentheses that define the Boolean, it's the equality by the
way. Parentheses just force the precedence.


Brian

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Jim Swain
Sent: 01 August 2013 13:24
To: U2 Users List
Subject: Re: [U2] What is true

This is not true as when A='HELLO'  IF (A) returns true.

You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY =
'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the
conditions inside the parenthesis are met, otherwise BRITISH is set to 0




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to
whom it is addressed. If you are not that person you are not permitted to
make use of the information and you are requested to notify us immediately
that you have received it and then destroy the copy in your possession.
Zafire Group may monitor outgoing and incoming e-mails.  By replying to this
e-mail you consent to such monitoring.  This e-mail message and any attached
files have been scanned for the presence of computer viruses. However, you
are advised that you open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and
Wales. Co. Reg. No. 3968255. Our registered address is Zafire House, Manor
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire
Aviation Software Limited is a limited liability company registered in
England and Wales. Co. Reg. No. 05577742. Our registered address is Zafire
House, Manor Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 13:17
To: U2 Users List
Subject: Re: [U2] What is true

Hi,
To add a little more to the discussion.  I know in UniVerse this is true and
I suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
Sent: Thursday, August 01, 2013 4:40 AM
To: 'U2 Users List'
Subject: Re: [U2] What is true

To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1
(all bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


___
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


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


Re: [U2] What is true

2013-08-01 Thread Jim Swain
This is not true as when A='HELLO'  IF (A) returns true.

You use the parenthesis to set a Boolean variable, i.e  BRITISH = (COUNTRY = 
'ENGLAND' OR COUNTRY = 'WALES')  etc   the var BRITISH is set to 1 when the 
conditions inside the parenthesis are met, otherwise BRITISH is set to 0




Jim Swain - Developer
Telephone: +44 (0) 1295 701 810  | Fax: +44 (0) 1295 701 819

www.zafire.com

Consider the environment.  Think before you print.

This is a commercial communication from Zafire Group.
This communication is confidential and is intended only for the person to whom 
it is addressed. If you are not that person you are not permitted to make use 
of the information and you are requested to notify us immediately that you have 
received it and then destroy the copy in your possession.  Zafire Group may 
monitor outgoing and incoming e-mails.  By replying to this e-mail you consent 
to such monitoring.  This e-mail message and any attached files have been 
scanned for the presence of computer viruses. However, you are advised that you 
open attachments at your own risk.

Zafire Limited is a limited liability company registered in England and Wales. 
Co. Reg. No. 3968255. Our registered address is Zafire House, Manor Park, 
Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 754 0161 55. Zafire Aviation 
Software Limited is a limited liability company registered in England and 
Wales. Co. Reg. No. 05577742. Our registered address is Zafire House, Manor 
Park, Banbury, Oxfordshire OX16 3TB. VAT Reg.No. 874 5890 70

If you have any concerns regarding the content of this e-mail please contact 
postmas...@zafire.com

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: 01 August 2013 13:17
To: U2 Users List
Subject: Re: [U2] What is true

Hi,
To add a little more to the discussion.  I know in UniVerse this is true and I 
suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.  
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
Sent: Thursday, August 01, 2013 4:40 AM
To: 'U2 Users List'
Subject: Re: [U2] What is true

To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1 (all 
bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on 
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


___
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] What is true

2013-08-01 Thread Tom Whitmore
Hi,
To add a little more to the discussion.  I know in UniVerse this is true and I 
suspect it is true in other flavors of Pick.

If you wrap a variable in parenthesis it will be treated as a Boolean test.  
For example:

A=''
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A=0
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in FALSE.
A='HELLO'
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.
A=1
IF (A) THEN CRT 'TRUE' ELSE CRT 'FALSE'   will result in TRUE.

I have found this useful in coding.

Tom Whitmore
RATEX Business Solutions

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Brian Leach
Sent: Thursday, August 01, 2013 4:40 AM
To: 'U2 Users List'
Subject: Re: [U2] What is true

To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1 (all 
bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on 
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


___
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] What is true

2013-08-01 Thread Brian Leach
To clarify

In multivalue, True is not False, where False is anything that is 'falsy'
i.e. zero or empty.
Obviously different than other languages, notably those where true is -1
(all bits set on a signed integer).

So:

A = "HELLO"
IF A THEN CRT A :" WORLD"

Gives HELLO WORLD

Regarding file variables, the best way to check for these being assigned on
UniVerse is to use FILEINFO().

If FileInfo(SomeUnassignedVariable, 0) Then
   Crt "This is an open file variable"
End Else
   Crt "This isn't"
End

Brian


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


Re: [U2] What is true

2013-07-31 Thread Tony Gravagno
From: Keith Johnson
> Hi Tony,
> 'Twas a teensy bug under an unusual circumstance... Hey, wait a
> minute, you're the one who complained that no-one updated other
> people's code! You wouldn't be trying to yank Will's chain, would
you?

Indeed I do comment occasionally on the proportion of takers to givers
with MV FOSS, and the unfortunately low number of takers at that. When
I saw your name on a recent update I had to chuckle at the
coincidence/irony - no yankin intended.

BTW, Keith, I dunno if you got an email I sent to Emerald Glen today.
The old domain is gone and your contact info on PickWiki is old - I
was concerned that we had lost ya. Thanks for chiming in.

Since we're here, as to testing file vars - in a platform where we
have so few data types I'd consider it quite poor for a developer to
not know if a given variable was supposed to contain a file
descriptor, or to try to use it without testing for assignment. My
approach is to use IF NOT(ASSIGNED(FVAR)) or in Unidata IF
UNASSIGNED(FVAR). But at a higher level where I only open files once,
I do this:

IF NOT(ASSIGNED(INITIALIZED)) OR ( ASSIGNED(INITIALIZED) AND
NOT(INITIALIZED)) THEN
  OK = 1 
  GOSUB OPEN.FILES ; * note, no need to check individual files
  IF OK THEN GOSUB OTHER.INITS
  IF NOT(OK) THEN
  GOSUB REPORT.ERROR
  RETURN ; * leave without setting init, app is in a bad state
  END
  INITIALIZED = 1
END
* OK to continue from here
* Don't even attempt file operations if Not(Initialized)

T
http://Nebula-RnD.com/blog  
http://Twitter.com/TonyGravagno 
http://www.LinkedIn.com/in/TonyGravagno 
Visit http://PickWiki.com! Contribute!  
http://groups.google.com/group/mvdbms   
https://bitbucket.org/foss4mv/  


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


Re: [U2] What is true

2013-07-31 Thread Keith Johnson [DATACOM]
Hi Wil,

That indeed was my code - ten years old now!

I think I read the same article as Kevin. I don't use it in my day to day 
programming (which is in Universe and QM, thus using @TRUE and @FALSE) but I 
think I still would use it for Pickwiki. Just a style thing - de gustibus non 
disputandum est, after all.

Hi Tony,

'Twas a teensy bug under an unusual circumstance... Hey, wait a minute, you're 
the one who complained that no-one updated other people's code! You wouldn't be 
trying to yank Will's chain, would you?


Regards, Keith


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


Re: [U2] What is true

2013-07-31 Thread Wjhonson
On this sidethread, like a true hacker I poked rather a lot at the Ultimate 
implementation of the Select variable
I discovered that the groupid was embedded in that variable, if you walk it 
byte-by-byte
So I was able to use that to show the users, on a BASIC SELECT how *far* the 
select had progressed through the file.
Which also determined a "best guess" at when it was going to finish the job.

IIRC, Adds had the same type of select variable.  I haven't tried to play that 
trick in Universe only because I haven't yet encountered a client who was 
trying to process ten million records at once.

 

 

 

-Original Message-
From: Wols Lists 
To: u2-users 
Sent: Wed, Jul 31, 2013 1:48 pm
Subject: Re: [U2] What is true


On 31/07/13 09:06, Martin Phillips wrote:
> Of course, nothing is ever completely black and white. As multivalue Basic 
> has 
developed, internal data types have gone beyond
> simply numbers and strings. If I write
>IF FVAR THEN ...
> where FVAR is a file variable, what do I expect this to do? The language 
definition does not tell us but most multivalue products
> would give us a data type error of some sort because there is no rule for 
transforming a file variable to a Boolean value.

Actually, UV gives us a program crash (or certainly used to :-(

Which was a real bummer when porting programs from INFORMATION, seeing
as before the CLOSE statement was introduced, doing FILEVAR="" was the
*recommended* way to close a file!

So a fair chunk of PI code would be of the form "IF FILEVAR EQ "" THEN
OPEN FILE".

Feed that code into UV and BOOM! If you were unlucky enough to test an
open variable your program blew up!

Cheers,
Wol
___
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] What is true

2013-07-31 Thread Wols Lists
On 31/07/13 09:06, Martin Phillips wrote:
> Of course, nothing is ever completely black and white. As multivalue Basic 
> has developed, internal data types have gone beyond
> simply numbers and strings. If I write
>IF FVAR THEN ...
> where FVAR is a file variable, what do I expect this to do? The language 
> definition does not tell us but most multivalue products
> would give us a data type error of some sort because there is no rule for 
> transforming a file variable to a Boolean value.

Actually, UV gives us a program crash (or certainly used to :-(

Which was a real bummer when porting programs from INFORMATION, seeing
as before the CLOSE statement was introduced, doing FILEVAR="" was the
*recommended* way to close a file!

So a fair chunk of PI code would be of the form "IF FILEVAR EQ "" THEN
OPEN FILE".

Feed that code into UV and BOOM! If you were unlucky enough to test an
open variable your program blew up!

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


Re: [U2] What is true

2013-07-31 Thread Kevin King
There is only one truth, and it's false (0 or "").


On Wed, Jul 31, 2013 at 8:30 AM, Larry Hiscock  wrote:

> UniData treats WITH fieldname as the equivalent of WITH fieldname > "".
> Both 1 and 0 would be selected, the empty string would not.
>
> Larry Hiscock
> Western Computer Services
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org
> [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charles
> Stevenson
> Sent: Wednesday, July 31, 2013 3:46 AM
> To: U2 Users List
> Subject: Re: [U2] What is true
>
> And then there's the query language:
>
> Suppose INVOICED field is supposed to be true or false.  Stored as 1 or 0,
> but maybe left null in some records (We've all been there.):
>
>   SELECT CUSTOMER WITH INVOICED
>
> If INVOICED is "0" or null, will said CUSTOMER record be selected or not?
> UV selects if "0",  but excludes if null.
> Do all MV platforms work that way?
>
>
> On 7/31/2013 11:06 AM, Martin Phillips wrote:
> > Hi,
> >
> >> About the true/false thing, I always use 0 and 1 but I was chastised
> >> about that by a colleague recently, that it might not be completely
> >> cross-platform, and now I stutter on it every time I do that,
> >> wondering if I'm not really following a best practice
> > I seem to recall this same topic being discussed a year or two back,
> perhaps in a different group.
> >
> > In the multivalue world, the language definition says that anything that
> returns true/false returns 1 for true, 0 for false.
> > Anything that interprets a value as true/false treats zero and a null
> > string as false, everything else as true. This definition holds for
> > all multivalue products but not necessarily in other languages. Any new
> multivalue product that breaks this definition is probably doomed to
> failure
> because migration of existing applications would become a nightmare task.
> >
> > In our type variant world where we have no such thing as a Boolean data
> type, it is very easy to write statements such as
> > INVOICED = 1
> >
> > Is INVOICED a Boolean variable, perhaps telling us in this case that
> > an invoice has been raised? Or, is it a state flag with multiple values
> for which this might be indicating a type of invoice that has been sent?
> There is no way for the reader to tell.
> >
> > At risk of starting a whole new discussion on programming style (and I
> > start form the viewpoint that there are many acceptable styles, it is
> > more important to be consistent), this is probably best resolved by
> > use of tokens. I have for many years held an interesting opinion that a
> program should never have any hard coded numeric values except perhaps
> zero,
> not that I adhere rigidly to my own opinion. The above line becomes
> something like
> > INVOICED = TRUE
> > or
> > INVOICED = INV.PDF
> >
> > Now, all is clear(er) to the reader.
> >
> > Prime Information introduced @FALSE and @TRUE as symbolic constants (0
> > and 1 respectively) to avoid the need for our own equated tokens and
> several other multivalue products have followed this convention.
> >
> > Of course, nothing is ever completely black and white. As multivalue
> > Basic has developed, internal data types have gone beyond simply numbers
> and strings. If I write
> > IF FVAR THEN ...
> > where FVAR is a file variable, what do I expect this to do? The
> > language definition does not tell us but most multivalue products would
> give us a data type error of some sort because there is no rule for
> transforming a file variable to a Boolean value.
> >
> >
> > Martin Phillips
> > Ladybridge Systems Ltd
> > 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> > +44 (0)1604-709200
> >
>
> ___
> 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] What is true

2013-07-31 Thread Larry Hiscock
UniData treats WITH fieldname as the equivalent of WITH fieldname > "".
Both 1 and 0 would be selected, the empty string would not.

Larry Hiscock
Western Computer Services

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charles Stevenson
Sent: Wednesday, July 31, 2013 3:46 AM
To: U2 Users List
Subject: Re: [U2] What is true

And then there's the query language:

Suppose INVOICED field is supposed to be true or false.  Stored as 1 or 0,
but maybe left null in some records (We've all been there.):

  SELECT CUSTOMER WITH INVOICED

If INVOICED is "0" or null, will said CUSTOMER record be selected or not?
UV selects if "0",  but excludes if null.
Do all MV platforms work that way?


On 7/31/2013 11:06 AM, Martin Phillips wrote:
> Hi,
>
>> About the true/false thing, I always use 0 and 1 but I was chastised 
>> about that by a colleague recently, that it might not be completely 
>> cross-platform, and now I stutter on it every time I do that, 
>> wondering if I'm not really following a best practice
> I seem to recall this same topic being discussed a year or two back,
perhaps in a different group.
>
> In the multivalue world, the language definition says that anything that
returns true/false returns 1 for true, 0 for false.
> Anything that interprets a value as true/false treats zero and a null 
> string as false, everything else as true. This definition holds for 
> all multivalue products but not necessarily in other languages. Any new
multivalue product that breaks this definition is probably doomed to failure
because migration of existing applications would become a nightmare task.
>
> In our type variant world where we have no such thing as a Boolean data
type, it is very easy to write statements such as
> INVOICED = 1
>
> Is INVOICED a Boolean variable, perhaps telling us in this case that 
> an invoice has been raised? Or, is it a state flag with multiple values
for which this might be indicating a type of invoice that has been sent?
There is no way for the reader to tell.
>
> At risk of starting a whole new discussion on programming style (and I 
> start form the viewpoint that there are many acceptable styles, it is 
> more important to be consistent), this is probably best resolved by 
> use of tokens. I have for many years held an interesting opinion that a
program should never have any hard coded numeric values except perhaps zero,
not that I adhere rigidly to my own opinion. The above line becomes
something like
> INVOICED = TRUE
> or
> INVOICED = INV.PDF
>
> Now, all is clear(er) to the reader.
>
> Prime Information introduced @FALSE and @TRUE as symbolic constants (0 
> and 1 respectively) to avoid the need for our own equated tokens and
several other multivalue products have followed this convention.
>
> Of course, nothing is ever completely black and white. As multivalue 
> Basic has developed, internal data types have gone beyond simply numbers
and strings. If I write
> IF FVAR THEN ...
> where FVAR is a file variable, what do I expect this to do? The 
> language definition does not tell us but most multivalue products would
give us a data type error of some sort because there is no rule for
transforming a file variable to a Boolean value.
>
>
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
>

___
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] What is true

2013-07-31 Thread Martin Phillips
Hi,

The query processor defines "WITH fieldname" that has no relational operator as 
a test for non-null so this is not the same as a
true/false test. Again, as far as I know, this is the same across all 
multivalue products.



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




-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Charles Stevenson
Sent: 31 July 2013 11:46
To: U2 Users List
Subject: Re: [U2] What is true

And then there's the query language:

Suppose INVOICED field is supposed to be true or false.  Stored as 1 or 
0, but maybe left null in some records (We've all been there.):

  SELECT CUSTOMER WITH INVOICED

If INVOICED is "0" or null, will said CUSTOMER record be selected or not?
UV selects if "0",  but excludes if null.
Do all MV platforms work that way?


On 7/31/2013 11:06 AM, Martin Phillips wrote:
> Hi,
>
>> About the true/false thing, I always use 0 and 1 but I was chastised
>> about that by a colleague recently, that it might not be completely
>> cross-platform, and now I stutter on it every time I do that,
>> wondering if I'm not really following a best practice
> I seem to recall this same topic being discussed a year or two back, perhaps 
> in a different group.
>
> In the multivalue world, the language definition says that anything that 
> returns true/false returns 1 for true, 0 for false.
> Anything that interprets a value as true/false treats zero and a null string 
> as false, everything else as true. This definition
> holds for all multivalue products but not necessarily in other languages. Any 
> new multivalue product that breaks this definition
is
> probably doomed to failure because migration of existing applications would 
> become a nightmare task.
>
> In our type variant world where we have no such thing as a Boolean data type, 
> it is very easy to write statements such as
> INVOICED = 1
>
> Is INVOICED a Boolean variable, perhaps telling us in this case that an 
> invoice has been raised? Or, is it a state flag with
> multiple values for which this might be indicating a type of invoice that has 
> been sent? There is no way for the reader to tell.
>
> At risk of starting a whole new discussion on programming style (and I start 
> form the viewpoint that there are many acceptable
> styles, it is more important to be consistent), this is probably best 
> resolved by use of tokens. I have for many years held an
> interesting opinion that a program should never have any hard coded numeric 
> values except perhaps zero, not that I adhere rigidly
to
> my own opinion. The above line becomes something like
> INVOICED = TRUE
> or
> INVOICED = INV.PDF
>
> Now, all is clear(er) to the reader.
>
> Prime Information introduced @FALSE and @TRUE as symbolic constants (0 and 1 
> respectively) to avoid the need for our own equated
> tokens and several other multivalue products have followed this convention.
>
> Of course, nothing is ever completely black and white. As multivalue Basic 
> has developed, internal data types have gone beyond
> simply numbers and strings. If I write
> IF FVAR THEN ...
> where FVAR is a file variable, what do I expect this to do? The language 
> definition does not tell us but most multivalue products
> would give us a data type error of some sort because there is no rule for 
> transforming a file variable to a Boolean value.
>
>
> Martin Phillips
> Ladybridge Systems Ltd
> 17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
> +44 (0)1604-709200
>

___
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] What is true

2013-07-31 Thread Charles Stevenson

And then there's the query language:

Suppose INVOICED field is supposed to be true or false.  Stored as 1 or 
0, but maybe left null in some records (We've all been there.):


 SELECT CUSTOMER WITH INVOICED

If INVOICED is "0" or null, will said CUSTOMER record be selected or not?
UV selects if "0",  but excludes if null.
Do all MV platforms work that way?


On 7/31/2013 11:06 AM, Martin Phillips wrote:

Hi,


About the true/false thing, I always use 0 and 1 but I was chastised
about that by a colleague recently, that it might not be completely
cross-platform, and now I stutter on it every time I do that,
wondering if I'm not really following a best practice

I seem to recall this same topic being discussed a year or two back, perhaps in 
a different group.

In the multivalue world, the language definition says that anything that 
returns true/false returns 1 for true, 0 for false.
Anything that interprets a value as true/false treats zero and a null string as 
false, everything else as true. This definition
holds for all multivalue products but not necessarily in other languages. Any 
new multivalue product that breaks this definition is
probably doomed to failure because migration of existing applications would 
become a nightmare task.

In our type variant world where we have no such thing as a Boolean data type, 
it is very easy to write statements such as
INVOICED = 1

Is INVOICED a Boolean variable, perhaps telling us in this case that an invoice 
has been raised? Or, is it a state flag with
multiple values for which this might be indicating a type of invoice that has 
been sent? There is no way for the reader to tell.

At risk of starting a whole new discussion on programming style (and I start 
form the viewpoint that there are many acceptable
styles, it is more important to be consistent), this is probably best resolved 
by use of tokens. I have for many years held an
interesting opinion that a program should never have any hard coded numeric 
values except perhaps zero, not that I adhere rigidly to
my own opinion. The above line becomes something like
INVOICED = TRUE
or
INVOICED = INV.PDF

Now, all is clear(er) to the reader.

Prime Information introduced @FALSE and @TRUE as symbolic constants (0 and 1 
respectively) to avoid the need for our own equated
tokens and several other multivalue products have followed this convention.

Of course, nothing is ever completely black and white. As multivalue Basic has 
developed, internal data types have gone beyond
simply numbers and strings. If I write
IF FVAR THEN ...
where FVAR is a file variable, what do I expect this to do? The language 
definition does not tell us but most multivalue products
would give us a data type error of some sort because there is no rule for 
transforming a file variable to a Boolean value.


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



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


Re: [U2] What is true

2013-07-31 Thread Martin Phillips
Hi,

> About the true/false thing, I always use 0 and 1 but I was chastised
> about that by a colleague recently, that it might not be completely
> cross-platform, and now I stutter on it every time I do that,
> wondering if I'm not really following a best practice 

I seem to recall this same topic being discussed a year or two back, perhaps in 
a different group.

In the multivalue world, the language definition says that anything that 
returns true/false returns 1 for true, 0 for false.
Anything that interprets a value as true/false treats zero and a null string as 
false, everything else as true. This definition
holds for all multivalue products but not necessarily in other languages. Any 
new multivalue product that breaks this definition is
probably doomed to failure because migration of existing applications would 
become a nightmare task.

In our type variant world where we have no such thing as a Boolean data type, 
it is very easy to write statements such as
   INVOICED = 1

Is INVOICED a Boolean variable, perhaps telling us in this case that an invoice 
has been raised? Or, is it a state flag with
multiple values for which this might be indicating a type of invoice that has 
been sent? There is no way for the reader to tell.

At risk of starting a whole new discussion on programming style (and I start 
form the viewpoint that there are many acceptable
styles, it is more important to be consistent), this is probably best resolved 
by use of tokens. I have for many years held an
interesting opinion that a program should never have any hard coded numeric 
values except perhaps zero, not that I adhere rigidly to
my own opinion. The above line becomes something like
   INVOICED = TRUE
or
   INVOICED = INV.PDF

Now, all is clear(er) to the reader.

Prime Information introduced @FALSE and @TRUE as symbolic constants (0 and 1 
respectively) to avoid the need for our own equated
tokens and several other multivalue products have followed this convention.

Of course, nothing is ever completely black and white. As multivalue Basic has 
developed, internal data types have gone beyond
simply numbers and strings. If I write
   IF FVAR THEN ...
where FVAR is a file variable, what do I expect this to do? The language 
definition does not tell us but most multivalue products
would give us a data type error of some sort because there is no rule for 
transforming a file variable to a Boolean value.


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


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


Re: [U2] What is true

2013-07-30 Thread Kevin King
For me it was more of a concern when there were new players entering the
market.  As we haven't really seen any new MV platforms in a good long
while it seems like this is much less of a concern.


On Tue, Jul 30, 2013 at 9:21 PM, Tony Gravagno <3xk547...@sneakemail.com>wrote:

> > From: Wjhonson
> > I saw it here by "KRJ" whoever that is
> > http://www.pickwiki.com/cgi-bin/wiki.pl?Compare
>
>
> That's Keith Johnson in NZ. What an unusual last name... ;)
> Ironically, it looks like he recently modified one of your postings to
> PickWiki too.
>
> About the true/false thing, I always use 0 and 1 but I was chastised
> about that by a colleague recently, that it might not be completely
> cross-platform, and now I stutter on it every time I do that,
> wondering if I'm not really following a best practice:
>
> OK = 1
> IF OK THEN FOO ELSE BAR
> IF NOT(OK) THEN BLAH ...
>
> I'm curious too - is anyone aware of a platform/flavor where this has
> not worked in the last decade?
>
>
> Tony Gravagno
> Nebula Research and Development
> TG@ remove.pleaseNebula-RnD.com
> http://Nebula-RnD.com/blog
> Visit http://PickWiki.com! Contribute!
> http://Twitter.com/TonyGravagno
> http://groups.google.com/group/mvdbms
> https://bitbucket.org/foss4mv/nebulaware
>
>
> ___
> 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] What is true

2013-07-30 Thread Tony Gravagno
> From: Wjhonson 
> I saw it here by "KRJ" whoever that is
> http://www.pickwiki.com/cgi-bin/wiki.pl?Compare


That's Keith Johnson in NZ. What an unusual last name... ;)
Ironically, it looks like he recently modified one of your postings to
PickWiki too.

About the true/false thing, I always use 0 and 1 but I was chastised
about that by a colleague recently, that it might not be completely
cross-platform, and now I stutter on it every time I do that,
wondering if I'm not really following a best practice:

OK = 1
IF OK THEN FOO ELSE BAR
IF NOT(OK) THEN BLAH ...

I'm curious too - is anyone aware of a platform/flavor where this has
not worked in the last decade?


Tony Gravagno   
Nebula Research and Development 
TG@ remove.pleaseNebula-RnD.com 
http://Nebula-RnD.com/blog  
Visit http://PickWiki.com! Contribute!  
http://Twitter.com/TonyGravagno 
http://groups.google.com/group/mvdbms   
https://bitbucket.org/foss4mv/nebulaware


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


Re: [U2] What is true

2013-07-30 Thread Wjhonson
I saw it here by "KRJ" whoever that is

http://www.pickwiki.com/cgi-bin/wiki.pl?Compare



 

 

 

-Original Message-
From: Kevin King 
To: U2 Users List 
Sent: Tue, Jul 30, 2013 6:10 pm
Subject: Re: [U2] What is true


I picked up that trick from some old code may years ago, and haven't used
it in a while since @TRUE and @FALSE have been available on Unidata and
Universe, but you may be seeing some of my old code.  As far as I have
seen, TRUE is usually 1 on MV platforms, but at the time I started writing
that bit of code there were new players in the mix (i.e. jBase, mvBase,
microReality?) and it seemed prudent at the time to calculate truth rather
than assume it will always be 1.  This was not my idea, however.  I believe
I borrowed it from something I read in Spectrum back in the late 80's.


On Tue, Jul 30, 2013 at 6:49 PM, Wjhonson  wrote:

> Are there MV systems, which do not recognize 1 as being TRUE ?
> I typically EQUATE FALSE TO 0, TRUE TO 1
>
> But today I ran across code where they do this
>
> TRUE = (1=1)
> FALSE = NOT(TRUE)
>
> I suppose this works on all possible computer systems, but is it overkill
>  for multi-value ?
>
>
> ___
> 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] What is true

2013-07-30 Thread Kevin King
I picked up that trick from some old code may years ago, and haven't used
it in a while since @TRUE and @FALSE have been available on Unidata and
Universe, but you may be seeing some of my old code.  As far as I have
seen, TRUE is usually 1 on MV platforms, but at the time I started writing
that bit of code there were new players in the mix (i.e. jBase, mvBase,
microReality?) and it seemed prudent at the time to calculate truth rather
than assume it will always be 1.  This was not my idea, however.  I believe
I borrowed it from something I read in Spectrum back in the late 80's.


On Tue, Jul 30, 2013 at 6:49 PM, Wjhonson  wrote:

> Are there MV systems, which do not recognize 1 as being TRUE ?
> I typically EQUATE FALSE TO 0, TRUE TO 1
>
> But today I ran across code where they do this
>
> TRUE = (1=1)
> FALSE = NOT(TRUE)
>
> I suppose this works on all possible computer systems, but is it overkill
>  for multi-value ?
>
>
> ___
> 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