[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [open-cobol-list] invalid VALUE clause
From: |
William M. Klein |
Subject: |
RE: [open-cobol-list] invalid VALUE clause |
Date: |
Tue Feb 17 01:57:12 2004 |
You are correct that numeric-edited items must have alphanumeric literals in
their value clause (and I was in error). There is a "relevant note" on page
370 of the 2002 Standard which says,
"NOTE The programmer is responsible for specifying the numeric-edited, or
national-edited item in edited form."
But as that is ONLY a note, the compiler certainly is not required to
"restrict" VALUE clauses to those that match the picture clause.
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Keisuke Nishida
> Sent: Tuesday, February 17, 2004 3:24 AM
> To: William M. Klein
> Cc: address@hidden
> Subject: Re: [open-cobol-list] invalid VALUE clause
>
> At Tue, 10 Feb 2004 16:15:29 -0600,
> William M. Klein wrote:
> >
> > Using Z's makes a numeric field a numeric-edited field, not
> an alphanumeric
> > or alphanumeric-edited field. (The same is true about using
> the BLANK WHEN
> > ZERO clause).
> >
> > The reason that a VALUE SPACE is invalid relates to the
> MOVE rules which (in
> > the '85 Standard - on page VI-104) states,
>
> It seems different rules are applied between the VALUE clause and
> the MOVE statement. According to the COBOL 2002 standard,
>
> | ISO/IEC 1989:2002
> | 13.16.61 VALUE clause
> | 13.16.61.2 4) If the item is of class alphabetic or alphanumeric,
> | literals in the VALUE clause shall be alphanumeric literals. [...]
>
> Note that the class of a numeric-edited field is alphanumeric,
> though the category of it is numeric-edited. Thus, the VALUE clause
> of a numeric-edited field must be an alphanumeric literal, and the
> value SPACE would be legal here (even though it is not desirable).
>
> Furthermore, as far as I can understand, the standard requires the
> compiler *not* to check the value whether it matches to the picture
> definition. For example, the following definition is legal:
>
> 01 X PIC ZZ9 VALUE "abc".
>
> On the other hand, the MOVE statement requires numeric values to be
> stored in numeric-edited items, and SPACE would be illegal here.
>
> I'll fix this problem so that SPACE can be accepted.
>
> Keisuke
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> open-cobol-list mailing list
> address@hidden
> https://lists.sourceforge.net/lists/listinfo/open-cobol-list
>