Menu

gnucobolcgi.cob has a syntax error: gnucobolcgi.cob:19: error: FILE STATUS 'in-status' must be 2 characters long

2023-09-04
2023-09-04
  • Jeff Silverman

    Jeff Silverman - 2023-09-04

    I would like to demonstrate that it is possible to interface a COBOL program and a web server. I found
    https://opencobol.add1tocobol.com/gnucobolcgi/gnucobolcgi.cob . When I attempt to compile it, I get:

    $ cobc -x gnucobolcgi.cob
    gnucobolcgi.cob:19: error: FILE STATUS 'in-status' must be 2 characters long
    $
    
    $ cobc -V
    cobc (GnuCOBOL) 3.1.2.0
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward Hart
    Built     Sep 14 2021 19:23:38
    Packaged  Dec 23 2020 12:04:58 UTC
    C version "11.2.0"
    

    I am a complete COBOL newbie, I have no idea if I have an out of date compiler, if the compilation instructions have changed, if the code is missing a revision.

     
    • Vincent (Bryan) Coen

      Change the io-status to PIC XX (or if you want PIC 99).

      It then compiles.

      Not all code shown in the FAQ compiles as much is very old and was tested in very old versions of the compiler.

      Yes, the compiler you have is out of date as current version is v3.2 but it should still work.

      Vince

       

      Last edit: Simon Sobisch 2023-09-04
    • Simon Sobisch

      Simon Sobisch - 2023-09-04

      Note: the FAQ moved and is now available at https://gnucobol.sourceforge.io/faq/index.html#how-do-i-use-gnucobol-for-cgi - that said, this program is still unchanged.

      @btiffin - please adjust the io-status in the FAQ in this program. I'd suggest to have it as PIC XX and check for io-status (1:1) = '0' / not = '0', or doing the same with a level 88 (I've never seen a check for io-status > 9 / < 10 before).

       

Anonymous
Anonymous

Add attachments
Cancel