bug-gnucobol
[Top][All Lists]
Advanced

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

[open-cobol-list] possibly bug: Compare: numeric (USAGE COMP ...) wit


From: Thomas Biehler
Subject: [open-cobol-list] possibly bug: Compare: numeric (USAGE COMP ...) with alphanumeric
Date: Fri May 7 07:05:06 2004
User-agent: KMail/1.4.3

hi all,

i have attached a testprogram "TESTCOMPARE.cob"  (ANSI 1985!)
which shows the problematic case of comparison:

    PIC S9(4) COMP   =    PIC X(4)
   
    (numeric field with a small value => 1 =  "0001")

There are references to the ANSI 1985 / ISO  2002 standard inside.

None of my compiler give a warning or error at compiling stage!
Instead the runtime behavior is different!  :-(

I have compiled it with Micro Focus Compiler with the following flags:

   cob  -CANS85 -CFLAG=ANS85 -CWARNING=3 TESTCOMPARE.cob

No warnings and no ANSI-FLAGS at all in the compiler-output!
(==> The same behavior with BULL GCOS7 Compiler!)

Runtime-Results:
=====================================================

with Micro-Focus Compiler (= same results with GCOS 7000 Compiler!)
===================================================
#> cobrun TESTCOMPARE.int
COMPARE:  NUM-DISPLAY = X   SUCCESSFULL
COMPARE:  NUM-COMP = X  SUCCESSFULL
COMPARE:  NUM-DISPLAY => NUM-FIELD-X = X  SUCCESSFULL
COMPARE:  NUM-COMP => NUM-FIELD-X = X  SUCCESSFULL


with open-cobol  (cobc -v -Wall  --> no warnings! )
===================================================
#> ./TESTCOMPARE    
COMPARE:  NUM-DISPLAY = X   SUCCESSFULL
COMPARE:  NUM-COMP = X  FAILED!
COMPARE:  NUM-DISPLAY => NUM-FIELD-X = X  SUCCESSFULL
COMPARE:  NUM-COMP => NUM-FIELD-X = X  SUCCESSFULL


with tinycobol:  (htcobol -F --> no warnings!)
===================================================
#> ./TESTCOMPARE
COMPARE:  NUM-DISPLAY = X   SUCCESSFULL
COMPARE:  NUM-COMP = X  FAILED!
COMPARE:  NUM-DISPLAY => NUM-FIELD-X = X  SUCCESSFULL
COMPARE:  NUM-COMP => NUM-FIELD-X = X  FAILED!


If you have another compiler  (IBM , Accu-Cobol, Fujitsu ...) , 
could you please compile it (with maximal ANSI-Flagging, "all warnings") 
and send the results  (warning, errors , output from running)
to this mailing-list.   

Im also very interested in what your meaning is about 
the problematic compare. 
(Allowed or forbidden from standard ?)

What is the standard conform behavior in ANSI 1985?
(ISO/IEC 2002 is clear !  (= simplified standard text!))

Is this a weakness in the standard ANSI 1985 standard ? 
   OR
a BUG in:
      1. open-cobol , tiny-cobol ...
      2. Micro Focus, BULL GCOS7 Compiler ...

My propose for changing open-cobol  is :
(after evaluate your results / meanings !)
-  give out a warning/error in ANSI 1985 mode
   (at least a warning if it ANSI-conform, error if not ANSI-conform!)
-  give out a sytnax error in ISO 2002 mode

Thanks and bye!

Thomas

Attachment: TESTCOMPARE.cob
Description: Text document


reply via email to

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