Re: a4gl string comparison broken?

Mike Aubury <[email protected]>
Newsgroups gmane.comp.lang.4gl.aubit.general
Message-ID <CAGAq4WFkHEUkiQjYwyc1ZN=C=v+q6qWhKZN8innZJmnuy=jLxQ@mail.gmail.com>
I'm not entirely sure what you're trying to do, but I'm fairly sure thats
not the way to do it :)

The embedded ^M is always going to cause issues .

It would be much better to use code like :

MAIN
DEFINE lc_char CHAR(5)
DEFINE ls_pos SMALLINT

LET lc_char = "AB"+ascii(13)+"DE"

FOR ls_pos = 1 to 5
    DISPLAY ls_pos
    IF lc_char[ls_pos] = ascii(13) THEN
        DISPLAY "YES"
    END IF
END FOR

END MAIN


Or

 IF ord(lc_char[ls_pos]) = 13 THEN
        DISPLAY "YES"
    END IF






On 26 July 2017 at 11:08, Malcolm Perrior <[email protected]>
wrote:

> Hi
>
> I’m debugging one of our old (very old) production Informix 4gls that’s
> worked tolerably well since 1998 on our HP-UX machine under i4GL
> V7.20/IDSV9.30; we’ve migrated all the code with a very high degree of
> success to a Ubuntu machine running Aubit against an Informix 12.10
> database with minimal code changes.
>
> One bit of code though has been causing screen display issues – it’s
> basically a horrible bit of 4GL that takes strings and displays them in a
> screen window and there’s a bit of string-slicing going on to strip
> unprintables and carriage returns etc. Under the Linux/a4gl environment it
> gets the test for CR wrong (it’s looking for CTRL-M) in that it seems to
> see whitespace as a CR and thus messes up our display. The following code
> snippet demonstrates it. When run in HPUX it’s fine and prints 1,2,3,4,5 as
> expected; but under Linux/a4gl it prints 1 2 3 YES 4 5.
>
>
>
> NB the “^M” is entered in vi using “CTRL-V CTRL-M”, and we get the same
> result whether we precede it with a backslash or without.
>
> NB(2) we’re compiling using ‘4glpc snippet.4gl –o snippet.4ge’. 4glpc –v
> shows: version 1.2, build level 38
>
>
>
> Looks like an a4gl bug?
>
>
>
>
>
> MAIN
>
> DEFINE lc_char CHAR(5)
>
> DEFINE ls_pos SMALLINT
>
>
>
> LET lc_char = "AB DE "
>
>
>
> FOR ls_pos = 1 to 5
>
>     DISPLAY ls_pos
>
>     IF lc_char[ls_pos] = "^M" THEN
>
>         DISPLAY "YES"
>
>     END IF
>
> END FOR
>
>
>
> END MAIN
>
>
>
> Thanks!
>
>
>
> *Malcolm Perrior*
>
> foresters.com
>
>
>
>
>
> **********************************************************************
> The information contained in this email is intended only for the
> individual or entity to whom it is addressed. It may contain privileged and
> confidential information and if you are not an intended recipient you must
> not copy, distribute or take any action in reliance on it. If you have
> received this email in error, please notify us immediately by telephone on
> (020) 8628 3456. Please also destroy and delete the message from your
> computer.
>
> Any opinions expressed in this message are those of the sender only and do
> not necessarily represent the views of Foresters. The sender may not be
> authorised to give financial advice and nothing in this message should be
> construed as offering such advice or entering into any contract on behalf
> of any Foresters Company.
>
> Forester Life Limited is authorised by the Prudential Regulation Authority
> and regulated by the Financial Conduct Authority and Prudential Regulation
> Authority.
>
> Forester Fund Management Limited is authorised and regulated by the
> Financial Conduct Authority. The Children’s Mutual is a trading name of
> Forester Fund Management Ltd.
>
> Companies within the Foresters UK Group are registered in England as
> follows:
> Forester Life Limited 2997655, Forester Fund Management Limited 4315370
> and Forester Holdings (Europe) Limited 3013082.
>
> Registered Offices for all companies within the Foresters UK Group:
> Foresters House, 2 Cromwell Avenue, Bromley, BR2 9BF. T 020 8628 3400. F
> 020 8628 3500. E [email protected] foresters.com
> **********************************************************************
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Aubit4gl-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss
>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
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.