gnucobol-users
[Top][All Lists]
Advanced

[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 10 14:16:09 2004

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,

"(3) Any move in which the receiving operand is an elementary item and the
sending operand is either a literal or an elementary item is an elementary
move.
Every elementary item belongs to one of the following categories: numeric,
alphabetic, numeric edited, alphanumeric edited. (See page VI-29, The
PICTURE
Clause.) Numeric literals belong to the category numeric and nonnumeric
literals belong to the category alphanumeric. The figurative constant ZERO
(ZEROS, ZEROES), when moved to a numeric or numeric edited item, belongs to
the
category numeric. In all other cases, it belongs to the category
alphanumeric.
The figurative constant SPACE (SPACES) belongs to the category alphabetic.
All
other figurative constants belong to the category alphanumeric."

NOTE WELL: you may NOT move an ALPHABETIC item a NUMERIC-EDITED item.

If for some (odd) reason you actually WANTED to place spaces into a numeric
item, you could (as far as syntax goes) do either of the following:

  05  AlphaNum  Value Spaces.
      10  NumEdited-Elem   Pic  ZZ9.99.

or
   10  NumEdit-Elem   Pic  ZZ9.99.
...
   Move spaces to NumEdit-Elem (1:)

Of course, in either case if you ever REFERENCED this item, you would run
into the "incompatible data" status.

The following is valid:

   05   NumEdit-1 Pic ZZZ.ZZ Value Zero. 
   05   NumEdit-2  Pic  999.99 Blank when zero Value Zero.

However, NEITHER of those would be valid with VALUE$ SPACES - even though
the items WOULD contain space characters.

  ***

I have (privately) asked to see a copy of an IBM Enterprise COBOL listing
"accepting" a VALUE SPACES with this.  It would be particularly interesting
to see what would happen if the program was compiled with 
  FLAGSTD(H)

> -----Original Message-----
> From: Wim Niemans ri [mailto:address@hidden 
> Sent: Tuesday, February 10, 2004 4:56 PM
> To: William M. Klein
> Cc: 'David Korn'; address@hidden
> Subject: RE: [open-cobol-list] invalid VALUE clause
> 
> Hi,
> 
> Using zero supression (ZZZ) in a picture clause makes it alfa-
> numeric. So, value space is perfectly legal.
> 
> Cheers,
> wim niemans
> 
> 
> On 9 Feb 2004 at 22:51, William M. Klein wrote:
> 
> > Why shouldn't you get an error?  If you had a "blank when 
> zero" clause - or
> > didn't have the "9's" in the PICTURE, then spaces would be 
> legal.  But I
> > don't think spaces are ever valid for a numeric-edited 
> picture clause *with*
> > some required numeric places. 
> > 
> > > -----Original Message-----
> > > From: address@hidden 
> > > [mailto:address@hidden On 
> > > Behalf Of David Korn
> > > Sent: Monday, February 09, 2004 10:14 AM
> > > To: address@hidden; 
> address@hidden
> > > Subject: [open-cobol-list] invalid VALUE clause
> > > 
> > > cc: address@hidden
> > > Subject: invalid VALUE clause
> > > --------
> > > 
> > > I am getting a compilation error, invalid VALUE clause, with 
> > > the following
> > > program:
> > > 
> > > =================cut here=====================
> > >        ID DIVISION.
> > >        PROGRAM-ID. VCAGP210.
> > >        ENVIRONMENT DIVISION.
> > >        DATA DIVISION.
> > >        WORKING-STORAGE SECTION.
> > >        01  WS-P-SUMM-HDR.
> > >            05  WS-P-SUMM-DETAIL-LINE.
> > >                10  WS-P-SUMM-DETAIL-LINE-PRINT.
> > >                    15  WS-P-SUMM-TOTAL  PIC Z,ZZZ,ZZ9.99 
> VALUE SPACES.
> > > =================cut here=====================
> > > 
> > > David Korn
> > > address@hidden
> > > 
> > > 
> > > -------------------------------------------------------
> > > The SF.Net email is sponsored by EclipseCon 2004
> > > Premiere Conference on Open Tools Development and Integration
> > > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> > > http://www.eclipsecon.org/osdn
> > > _______________________________________________
> > > open-cobol-list mailing list
> > > address@hidden
> > > https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> > > 
> > 
> > 
> > 
> > 
> > -------------------------------------------------------
> > The SF.Net email is sponsored by EclipseCon 2004
> > Premiere Conference on Open Tools Development and Integration
> > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
> > http://www.eclipsecon.org/osdn
> > _______________________________________________
> > open-cobol-list mailing list
> > address@hidden
> > https://lists.sourceforge.net/lists/listinfo/open-cobol-list
> > 
> 
> 
> 




reply via email to

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