gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[open-cobol-list] Re: compare numeric - alphanumeric


From: Margit Schubert-While
Subject: [open-cobol-list] Re: compare numeric - alphanumeric
Date: Sat May 8 02:57:00 2004

Hmm, interesting.
Firstly, note that the COMP field is only 2 bytes.
If you change the definition to S9(8) COMP - (4 bytes), then
both MF and OpenCob fail test 2 and 4.

I believe MF is wrong.
Synopsis :
From MF Lang Ref
Conditional expressions/comparison of nonnumeric operands :
"If the nonnumeric operand is an elementary data item or a
nonnumeric literal, the numeric operand is treated as though
it were moved to an elementary alphanumeric data item of the
same size as the numeric data item, and the contents of this
alphanumeric data item were compared to the nonnumeric item."

So, internally, the 2-byte COMP field should get moved to a 2-byte
alphanumeric field. Now the comparison should be 2-byte display
against 4-byte display. The 2-byte gets expanded on the right with spaces.
And this should give a not-equal.
QED or ?

Roger While




reply via email to

[Prev in Thread] Current Thread [Next in Thread]