bug-gnucobol
[Top][All Lists]
Advanced

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

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


From: Thomas Biehler
Subject: [open-cobol-list] possibly bug: accept into numeric field
Date: Tue Nov 4 04:57:10 2003
User-agent: KMail/1.4.3

Hi all,

i am not sure, but there is possibly a bug in open-cobol 
in the accept statement.

The problematic case is an accept into a numeric field 
when inputing less characters as in PICTURE-SIZE given.
The actual behaviour is the alignment to left (ok!) and
the filling up to the SIZE of the field with SPACES! ( IMO not ok)

I read in both ANSI-Standards (1985 / 2002) about the ACCEPT-Statement.
As far as i unterstand it, only the left alignment is ok.  
These standards are saying nothing about "alphanumeric fillup". 
(The MICRO-FOCUS Compiler does not makes the "alphanumeric fillup"
but IMHO the ANSI-Cobol Standards are not very precise in the Specfication
of the ACCEPT - "Format 1"; perhaps it is question of interpretation ?! )

cobc -std=cobol85 -fixed acceptbug.cob

CASE 1)  Input is a single "0":
... ./acceptbug

COMPARE IS   = 0
PLEASE GIVE IN ZERO:
0
INPUT WAS NOT = 0

COMPARE IS   <= 0
PLEASE GIVE IN ZERO:
0
INPUT WAS <= 0

-------------------------------------------------------------------------------------------

CASE 2)  Input are four "0":

... ./acceptbug

COMPARE IS   = 0
PLEASE GIVE IN ZERO:
0000
INPUT WAS = 0

COMPARE IS   <= 0
PLEASE GIVE IN ZERO:
0000
INPUT WAS <= 0

I am interessed what you say about this issue.

Bye

Thomas

Attachment: acceptbug.cob
Description: Text document


reply via email to

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