bug-gnucobol
[Top][All Lists]
Advanced

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

Re: [open-cobol-list] possibly bug: accept into numeric field


From: Thomas Biehler
Subject: Re: [open-cobol-list] possibly bug: accept into numeric field
Date: Tue Nov 11 05:28:07 2003
User-agent: KMail/1.4.3

On Tuesday 11 November 2003 02:43, you wrote:
> At Mon, 10 Nov 2003 18:24:37 +0100,
>
> Thomas Biehler wrote:
> > The intuitive behaviour:  (conform to ... ?!)
> > ==============================
> > From the user sight it looks like a
> > numeric MOVE from a shorter Field to a longer Field !!!!
> > (Right alignment , Fillup with Zero's)
> > But only one request to the User is made
> > (ACCEPT from  Terminal / SYSIN / Console ...)
> >   = only one Transfer of Data !?
>
> What results do you suppose to obtain (or do you get
> from other compilers) by the following ACCEPT?
>
>   Data item          Input
>   ---------          -----
>   01 X-1 PIC 99.     "123"
>   01 X-2 PIC 99V9.   "1"
>   01 X-3 PIC 99V9.   "123.4"
>
> Maybe "23", "010", and "234"?  But it seems the standard
> requires X-1 to be "12". (At leat the NIST Test Suite has
> a test for this.)  Gee.
>
> > I hope, it is now clear why i can not say
> > what I expect, only in a simple sentence.
> > I don't now what i should request from you.
> > (I have some ideas but i would like to see your answer first)
> > In general, i like compiler that follows standards !
> > (And i like good standards too :-) )
>
> I'd like to implement a compiler that follows standards
> by default, while I'd like to make it compatible with
> other COBOL compilers by giving appropriate options.
>
> Keisuke

Hi Keisuke,

i have tested your questions with the attached program  "accepttest.cob"
(So can other users easy test it with other compiler's and send the results!)

But after visiting the results i must repeat me!
Finding out what "the standard" (really) means and implement it
should be the very first step. After that, other "important compiler-dialects" 
could (or shoúld ?)  be supported. (or the "average of all" :-) )

A remark to my descripition of the "intuitive" behavior ;-)
The "numeric MOVE" describes only for the special case  from
shorter numeric source to a longer receiving numeric field! 

Take a precise look at the following results:

COBOL-85 Compiler on DPS-7000 (GCOS-7) System:  (handy programmed tests)
====================================================
Data-Item               Input        
01 X-1 PIC 99.       123     
==> Result:       Error-Message :  "Maximum Value 99: Please reenter"
01 X-2 PIC 99V9.   1
==> Result:       010  (as expected)
01 X-3 PIC 99V9.   123.4
==> Result:       Error-Message :  "Maximum Value 99.9: Please reenter"


current CVS-Version from Open-cobol:
=================================================== 

PLEASE GIVE IN VALUE  123  in X-1  (PIC 99) : 
123
VALUE OF X-1: /12/
 
PLEASE GIVE IN VALUE  1  in X-1  (PIC 99V9) : 
1
VALUE OF X-2: /1 .0/               <=== the bug 
 
PLEASE GIVE IN VALUE  123.4  in X-3  (PIC 99V9) : 
123.4
VALUE OF X-3: /12.3/              <=== ???


tiny-cobol 0.61 (with some but not all updates from CVS)
=================================================== 

PLEASE GIVE IN VALUE  123  in X-1  (PIC 99) : 
123
VALUE OF X-1: /23/                   <=== Ooops!
 
PLEASE GIVE IN VALUE  1  in X-2  (PIC 99V9) : 
1
VALUE OF X-2: /01.0/
 
PLEASE GIVE IN VALUE  123.4  in X-3  (PIC 99V9) : 
123.4
VALUE OF X-3: /23.4/               <=== ???


Micro Focus OCDS 4.2 (LINUX)
=====================================================
 
PLEASE GIVE IN VALUE  123  in X-1  (PIC 99) : 
123
VALUE OF X-1: /12/
 
PLEASE GIVE IN VALUE  1  in X-2  (PIC 99V9) : 
1
VALUE OF X-2: /010/
 
PLEASE GIVE IN VALUE  123.4  in X-3  (PIC 99V9) : 
123.4
VALUE OF X-3: /230/                  <==  Ooops !!!!!!!!  ?? 


I am sure, 
as more compiler will be tested,
as more different results will comming.

It seems so, that other people has also problems 
to unterstand "the standard" in the "ACCEPT - Format-1". 

What do you think about starting a thread 
in the comp.lang.cobol newsgroup?

Bye

Thomas

Attachment: accepttest.cob
Description: Text document


reply via email to

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