Menu

Is there a compiler option to correct this problem with entry of numeric data in GnuCOBOL?

2021-09-29
2021-10-01
  • Steve Millman

    Steve Millman - 2021-09-29

    Not sure how to delete or change a topic.. but seems the issue is that the GnuCOBOL 3.12b compile makes the ACCEPT verb read numbers (whether an integer or numeric edited field) from the left to the right.

    That does not seem like acceptable numeric handling.

    Does anyone have a way to compile around this? Or am I forced to change number fields to alphanumeric and redefine them, to ACCEPT the numbers I want?

    This sort of thing seems like a environmental variable should be the right way to go .. rather than to write unnecessary code.

    Microsoft had no problems with this sort of ACCEPT.. whether a plain number (integer) or a numeric edited number (like 9(6).99)..

     

    Last edit: Steve Millman 2021-09-29
    • Anonymous

      Anonymous - 2021-09-30

      I might suggest that you write a right justify, zero fill subroutine, If you are accepting periods, commas, currency along with the numeric data then the subroutine must be smart enough to understand that the data is not actually numeric but is edited numeric. Typically I would define a screen data field as PIC X - decode the data in the program - the keyed data remains intact on the screen as keyed and used in the program as actual numeric data.

       
  • Vincent (Bryan) Coen

    GC does accept numerics and numeric edited, it just does not do editing.

    So for a 9(6).99 and entering 45.33 you need to actually enter 000045.33
    and yes some thing that should have been fixed many years a go.

    On 01/10/2021 05:09, noreply@sourceforge.net wrote:

    Thank you. Will do. Thought perhaps I was missing a compiler option.
    This worked fine under Microsoft COBOL. Was surprised to see that
    GnuCOBOL screen handling did not accept numeric fields.

    On Wed, Sep 29, 2021 at 10:29 PM noreply@sourceforge.net wrote:

    I might suggest that you write a right justify, zero fill
    subroutine, If
    you are accepting periods, commas, currency along with the numeric
    data
    then the subroutine must be smart enough to understand that the
    data is not
    actually numeric but is edited numeric. Typically I would define a
    screen
    data field as PIC X - decode the data in the program - the keyed data
    remains intact on the screen as keyed and used in the program as
    actual
    numeric data.
    
     
  • Steve Millman

    Steve Millman - 2021-09-30

    Thank you. Will do. Thought perhaps I was missing a compiler option. This worked fine under Microsoft COBOL. Was surprised to see that GnuCOBOL screen handling did not accept numeric fields.

     

Anonymous
Anonymous

Add attachments
Cancel