[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: |
Mon Nov 10 09:28:03 2003 |
User-agent: |
KMail/1.4.3 |
On Friday 07 November 2003 23:55, Keisuke Nishida wrote:
> At Tue, 4 Nov 2003 13:54:39 +0100,
>
> Thomas Biehler wrote:
> > 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 ?! )
>
> I checked the COBOL 2002 standard right now. It says
>
> | 14.8.1.3 4) a) If the size of the receiving data item [...] exceeds
> | the size of the transferred data, the transferred data is stored
> | aligned to the left in the receiving data item [...], and additio
> | data is requested.
>
> so the correct behavior might be to read additional characters from
> the terminal. Is this what you expect? What other compilers do about
> this?
>
> Keisuke
>
Hi Keisuke
I agree with you.
The "correct" (= standard conform) behavior in COBOL 2002
and COBOL 1985 Standard (Nucleus Module Level 2 = (only in "High"-Subset))
is to read additional characters.
In COBOL 1985 Standard (Nucleus Module Level 1 = ("Minimum" and
"Intermediate"- Subset):
6.5.4
Format-:1
(4) ... In level 1, only one transfer of data is provided.
But this "old" behavior was at least "problematic". (IMO errorprone)
As i can remember me, you have to handle this case with
other statements after the ACCEPT in older "COBOL-Standard's"!
I have talked with other experienced cobol-programmers
and they have commited this.
I have some suggestions:
===================
Perhaps you should start a thread about the "standard-conform"
behavior from ACCEPT (FORMAT-1) in the comp.lang.cobol newsgroup.
(I can do it also and act as a "filter" :-) ; but a shorter way is a
more faster way to the real solution)
Or you can ask the developper from the tiny-cobol project
why they implemented it as i now works?!
Other compilers: (which i have acutally access to them)
========================================
I have tested the behaviour in MF-COBOL and with tinycobol 0.61.
Also, a friendly colleague on a BULL DPS-7000 (GCOS 7)
with that "Cobol-85" Compiler. Always the same intuitive behavior! :-))
(A old COBOLA / COBOLM = BULL DPS-6000 (GCOS 6) which
i have used long time ago, is no longer in use. I could have a look
in the handbook in the archive, but i think this does not make sense!)
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 !?
(But this seem's to be compiler differences from the ANSI standard
(= Compiler Dialects ?! / non-conforming behavior ?!))
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 :-) )
Further discussion with other people is necessary.
Sorry for the confusion and thanks for your patience!
Thomas
P.S. For me it does not hurry !
(Only ACCEPT FROM ENVIRONMENT-... are used in our application)
- [open-cobol-list] possibly bug: accept into numeric field, Thomas Biehler, 2003/11/04
- Re: [open-cobol-list] possibly bug: accept into numeric field, Keisuke Nishida, 2003/11/07
- Re: [open-cobol-list] possibly bug: accept into numeric field,
Thomas Biehler <=
- Re: [open-cobol-list] possibly bug: accept into numeric field, Keisuke Nishida, 2003/11/10
- Re: [open-cobol-list] possibly bug: accept into numeric field, masterok, 2003/11/11
- Re: [open-cobol-list] possibly bug: accept into numeric field, Alain Lucari, 2003/11/11
- RE: [open-cobol-list] possibly bug: accept into numeric field, William M. Klein, 2003/11/11
- Re: [open-cobol-list] possibly bug: accept into numeric field, Alain Lucari, 2003/11/12
- [open-cobol-list] MOVE Statement (was: possibly bug: accept into numeric field, William M. Klein, 2003/11/12
- Re: [open-cobol-list] possibly bug: accept into numeric field, Thomas Biehler, 2003/11/11
- Re: [open-cobol-list] possibly bug: accept into numeric field, Bernard Giroud, 2003/11/11
- Re: [open-cobol-list] possibly bug: accept into numeric field, Keisuke Nishida, 2003/11/14
- Re: [open-cobol-list] possibly bug: accept into numeric field, Alain Lucari, 2003/11/14