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.
@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).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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.
Change the io-status to
PIC XX(or if you wantPIC 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
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 XXand check forio-status (1:1) = '0'/not = '0', or doing the same with a level 88 (I've never seen a check forio-status > 9/< 10before).Hi Jeff,
in Contributions there are more examples and tools for web servers.
In Samples:
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/cgiform/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/cgiupload/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/cobsha3/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/cookie/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/imgcaptcha/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/imgscale/
In Tools:
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cgi4cobol/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/cobweb/
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/htm2cob/
This last one "htm2cob" includes all Samples Contributions above + PostgreSQL example.
There is a PDF document for this Contribution:
https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/tools/htm2cob/doc/
Step-by-step exapmles, and a working demo, written in GnuCOBOL + PostgreSQL
(The source code for this is also in Contribution):
https://wortfee.net
BR
László