[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] possibly bug: accept into numeric field
From: |
Keisuke Nishida |
Subject: |
Re: [open-cobol-list] possibly bug: accept into numeric field |
Date: |
Fri Nov 14 03:07:13 2003 |
User-agent: |
Wanderlust/2.10.0 (Venus) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryōmae) APEL/10.3 Emacs/21.2 (i386-redhat-linux-gnu) MULE/5.0 (SAKAKI) |
At Tue, 11 Nov 2003 14:25:20 +0100,
Thomas Biehler wrote:
>
> 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!)
Thanks.
> 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" :-) )
Sure. But it seems that the standard does not explicitly specify
how numeric accept should work. I think implementing the "intuitive"
behavior is good enough here.
> 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"
OK, let's make this the default behavior for terminal input.
We still need to think about non-terminal input (like redirection
on Unix), though.
> 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/ <=== ???
This is easy to implement. The following definition of cob_accept
will work as "alphanumeric to numeric move".
void
cob_accept (cob_field *f)
{
unsigned char data[FILENAME_MAX];
cob_field_attr attr = {COB_TYPE_ALPHANUMERIC, 0, 0, 0, 0};
cob_field temp = {0, data, &attr};
/* read data from stdin */
fgets (data, FILENAME_MAX, stdin);
temp.size = strlen (data) - 1;
/* move it to the field */
cob_move (&temp, f);
}
> What do you think about starting a thread
> in the comp.lang.cobol newsgroup?
I don't read the newsgroup, and I don't want to take too much
time on this topic. Just give me an advice how open-cobol
should work.
Keisuke
- Re: [open-cobol-list] possibly bug: accept into numeric field, (continued)
- 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, 2003/11/10
- 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 <=
- Re: [open-cobol-list] possibly bug: accept into numeric field, Alain Lucari, 2003/11/14
Re: [open-cobol-list] possibly bug: accept into numeric field, Thomas Biehler, 2003/11/14