[email protected] wrote:
> I came across this if condition and it goes to else part,
>
>    VAR.1 = "."
>
>     IF VAR.1 THEN
>         CRT "IF PASS"
>     END ELSE
>         CRT "IF FAIL"
>     END
>
> And the jbase release info.,
> RELEASE Information         : Major 5.0 , Minor 5 , Patch 0132 (Change
> 54733)
>
>
>   
This basically a function of the legacy system that jBASE is emulating 
and is, in this case, related to what a '.' means and why this form of 
expression of evaluation should not have been provided by UniVerse. It 
was obviously an attempt by someone at some point to try and act like 
other languages in terms of

The '.' is being seen as a numeric value in this operation and I think 
that it will evaluate to 0, the zero is then taken to mean false. You 
are much better off using an expression that qualifies what you mean by 
TRUE and FALSE as all good programming books will explain to you. For 
instance in C, when you write

int i =0
if (i) { ... }

It only works because the compiler infers the semantics and not because 
0 means false. You should really write:

if (i != 0) { ... }

Similarly, and perhaps even more so, in jBC you should not use

IF VAR.1

as you will get into messes like your observation. In jBC, unlike C, the 
compiler cannot infer the semantics in all cases but must rely on 
runtime type conversions, hence it is likely to be 'wrong' in some 
cases. It isn't wrong of course, it is just that the behavioral 
semantics of what a '.' means are screwed up by a bug in numeric 
evaluation that must be propagated by jBASE or all sorts of other badly 
formed logical expressions would not work like they used to on UniVerse 
(or whatever).

Change the expression to one that unambiguously yields a logical true or 
false, which is good coding practice anyway. In this case perhaps even 
your return value should change to something unambiguous, but I suspect 
that here you have just posted a summary example of a large picture. 
Generally this problem has to become:

IF var1 != ""

or IF var1 = 0

Or something similar.

Jim
> >
>   


--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to