bug-gnucobol
[Top][All Lists]
Advanced

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

Re: [Bug-GnuCOBOL] Incorrect parsing of numeric-edited values


From: Michael D. Setzer II
Subject: Re: [Bug-GnuCOBOL] Incorrect parsing of numeric-edited values
Date: Sun, 14 May 2017 02:05:34 +1000

I originally learned cobol on a 96K IBM System 34, and it wouldn't let you use 
any form of edited numeric values in calculations. Even the AS/400 compile 
code I just uploaded shows that it accecpts it, but treats the value 0 as value 
'0'?  It displays N: 0.

Also, do RPG II, RPG 400, and RPGILE. With the latest ones, you can have 
the decimals in numbers, and it works, but it gives a level 00 message that 
decimal errors will be handled. 

Currently teach classes using IBM's AS/400 in Arizonia from Guam from the 
RPG/400 and RPGILE classes. Using GNUCobol for the cobol class, but 
Cobol is also available on the AS/400.


On 13 May 2017 at 16:52, Edward Hart wrote:

From:   Edward Hart <address@hidden>
Date sent:      Sat, 13 May 2017 16:52:17 +0100
Subject:        Re: [Bug-GnuCOBOL] Incorrect parsing of numeric-edited values
To:     "Michael D. Setzer II" <address@hidden>
Copies to:      address@hidden

> From: &#160; &#160;Edward Hart &lt;<a 
> href="mailto:address@hidden";>address@hidden</a>&gt;<br>
> To:   &#160; &#160; &#160;David Newall &lt;<a 
> href="mailto:address@hidden";>address@hidden</a>&gt;<br>
> Subject:      &#160; &#160; &#160; &#160; Re: [Bug-GnuCOBOL] Incorrect 
> parsing of numeric-edited values<br>
> 
>     Shouldn't it be 01 N PIC V999 VALUE 0.
> 
> PIC .999 defines a numeric-edited item, which is of alphanumeric category. As 
> it's alphanumeric, 
> the standard requires the VALUE clause only have alphanumeric literals, not 
> numeric literals. 
> However, you're allowed to write MOVE 0 TO N in the procedure division and 
> GnuCOBOL 
> generates a hidden MOVE for each VALUE clause. So it seems strange that you 
> can't have 0 in 
> the VALUE clause.
> 
> Edward
> 
> On 13 May 2017 at 12:14, Michael D. Setzer II <address@hidden> wrote:
>     Am I missing something. Shouldn't it be 01 N PIC V999 VALUE 0.
>     Changing the code to that makes it compile and run without an issue that I
>     can see.
>     
>     
>     On 13 May 2017 at 11:55, Edward Hart wrote:
>     
>     From: Edward Hart <address@hidden>
>     Date sent:   Sat, 13 May 2017 11:55:48 +0100
>     To:  David Newall <address@hidden>
>     Subject:    Re: [Bug-GnuCOBOL] Incorrect parsing of numeric-edited 
>     values
>     Copies to:   address@hidden
>     
>     >
>     > Hi David,
>     >
>     > Thanks for the bug report and patch. This is technically extension, but 
> it's 
>     a very innocuous one
>     > and it's supported by Micro Focus (see VALUE Clause, General Rule 1.b). 
>     I'll commit this
>     > immediately.
>     >
>     > Edward
>     >
>     > On 13 May 2017 at 10:56, David Newall <address@hidden> 
>     wrote:
>     >  Hi all,
>     >
>     >  I believe it's bug:
>     >
>     >  address@hidden cat test-pic.cbl
>     >    IDENTIFICATION DIVISION.
>     >    PROGRAM-ID. TEST-PIC.
>     >
>     >    DATA DIVISION.
>     >    WORKING-STORAGE SECTION.
>     >    01 N PIC .999 VALUE 0.
>     >
>     >    PROCEDURE DIVISION.
>     >      START-PROCEDURE SECTION.
>     >    000-TOP.
>     >     DISPLAY 'N:', N.
>     >
>     >    END PROGRAM TEST-PIC.
>     >
>     >  address@hidden cobc -x test-pic.cbl
>     >  test-pic.cbl: 6: warning: alphanumeric value is expected
>     >
>     >  If I'm right (about it being a bug), the problem is in typck.c; and 
> because 
>     of
>     >  the "TODO" comment, I think it's something that slipped through the 
>     cracks.
>     >  I think NUMERIC-EDITED could be parsed the same as NUMERIC is.
>     >
>     >  I'm using r1560. I've attached my suggested patch.
>     >
>     >  Cheers,
>     >
>     >  David
>     >
>     >
>     
> 
>     +----------------------------------------------------------+
>      Michael D. Setzer II - Computer Science Instructor
>      Guam Community College Computer Center
>      mailto:address@hidden
>      mailto:address@hidden
>      Guam - Where America's Day Begins
>      G4L Disk Imaging Project maintainer
>      http://sourceforge.net/projects/g4l/
>     +----------------------------------------------------------+
>     
>     http://setiathome.berkeley.edu (Original)
>     Number of Seti Units Returned: 19,471
>     Processing time: 32 years, 290 days, 12 hours, 58 minutes
>     (Total Hours: 287,489)
>     
>     address@hidden CREDITS
>     ABC    16611686.340441 | EINSTEIN 135271960.288695
>     ROSETTA  61251302.766601 | SETI   105677196.318525
>     
> 
> 


+----------------------------------------------------------+
  Michael D. Setzer II -  Computer Science Instructor      
  Guam Community College  Computer Center                  
  mailto:address@hidden                            
  mailto:address@hidden
  Guam - Where America's Day Begins                        
  G4L Disk Imaging Project maintainer 
  http://sourceforge.net/projects/g4l/
+----------------------------------------------------------+

http://setiathome.berkeley.edu (Original)
Number of Seti Units Returned:  19,471
Processing time:  32 years, 290 days, 12 hours, 58 minutes
(Total Hours: 287,489)

address@hidden CREDITS
ABC         16611686.340441 | EINSTEIN   135271960.288695
ROSETTA     61251302.766601 | SETI       105677196.318525




reply via email to

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