Re: Behavior of boolen test of strings

Mike Aubury <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAGAq4WG0g3miyXNKxOejE7LmMcG5-bwRxUrYyeWFTOdEVZvvQg@mail.gmail.com>
String tests as boolean are "bad form".
The "fgllint" code checker explicitly checks this and reports it as a warning.

$fgllint test_string
  LINT : test_string.4gl Line 5 (Severity:6) NONINTBOOL
Converting non-integer to boolean


I think its probably best to fix your code.


On 13 June 2016 at 08:55, Gjerstad, Øyvind <[email protected]> wrote:
> We have some Informix 4gl code which uses character strings in boolean tests, i.e:
> if char_variable then
>   # something
> end if
>
> And the expected result is that when the string has any value, it evaluates to true. This works differently in Aubit 4gl. Apparently this expression is only true in Aubit when the character string can be converted to a number different from 0.
> Is this something we just have to live with, and change our programs, or is it a possiblity to change the behaviour in Aubit to work the same way as Informix?
>
>
> Test program:
> main
>   define p_tst_var varchar(255)
>   let p_tst_var = arg_val(1)
>
>   if p_tst_var then
>      display "All is well"
>   else
>      display "Not so good"
>   end if
> end main
> --
>
>
> Øyvind Gjerstad
> Systemkonsulent
>
>
> M +47 909 41 485
> [email protected]<mailto:[email protected]>
>
> ___________________
>
>
> PostNord Logistics AS
> T +47 09300
> IT og Forretningsutvikling
> Øran Vest
> Postboks 100
> 6301 Åndalsnes
> www.postnordlogistics.no<http://www.postnordlogistics.no>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> Aubit4gl-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Aubit4gl-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.