Using Zeus with GnuCOBOL 3.1.1

Find Tips and tricks on how to better use the Zeus IDE. Feel free to post your own tips but please do not post bug reports, feature requests or questions here.
Post Reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Using Zeus with GnuCOBOL 3.1.1

Post by jussij »

1. Go to the following download page an select from the various versions of GnuCOBOL available: https://www.arnoldtrembley.com/GnuCOBOL.htm

The list of options includes:
  • GnuCOBOL 3.1.1 BDB MinGW GnuCOBOL Compiler Includes Berkeley DataBase 18.1.40 for Indexed Sequential file access support, GMP 6.2.0, and PDCursesMod 4.2.0 (18.3 megabytes). Rename .7z to .exe for self-extracting archive.
  • GnuCOBOL 3.1.1 VBISAM MinGW GnuCOBOL Compiler Includes VBISAM 2.0.1 for Indexed Sequential file access support, GMP 6.2.0, and PDCursesMod 4.2.0 (17.1 megabytes). Rename .7z to .exe for self-extracting archive.
  • GnuCOBOL 3.1.1 NODB MinGW GnuCOBOL Compiler Without any ISAM support (NODB). This version includes GMP 6.2.0 and PDCursesMod 4.2.0 (17.0 megabytes). Rename .7z to .exe for self-extracting archive.
  • GnuCOBOL 3.1.1 BDB Diagnostic MinGW GnuCOBOL Includes Berkeley DataBase 18.1.40 for Indexed Sequential file access support, GMP 6.2.0, and PDCursesMod 4.2.0 (23.5 megabytes). Also includes FULL support for debugging GnuCOBOL 3.1.1 COMPILER INTERNALS. Rename .7z to .exe for self-extracting archive.
For this example the BDB MinGW GnuCOBOL Compiler option was used.

2. Download and install the contents of the zip file into this folder location.

Code: Select all

c:\GnuCOBOL\
NOTE: An alternative folder location can also be used, the batch file that follows will need to be modified to suit. In addition if that folder location contains white space some extra care will be needed as the folder location will need to be wrapped in quotes. As such it is best to start with a folder location that does not contain white space.

3. Add the following folder location to the PATH making sure to include the extra bin folder as shown:

Code: Select all

c:\GnuCOBOL\bin\
More details about the PATH can be found here: http://www.zeusedit.com/phpBB3/viewtopic.php?f=5&t=6176

4. Start the Zeus IDE and check the PATH has been correctly configure by using the Tools, DOS Command Line menu to run the following command:

Code: Select all

cobc -V
Running that command should result in the following output:
cobc (GnuCOBOL) 3.1.1.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 Dec 09 2020 16:46:55
Packaged Dec 08 2020 22:56:13 UTC
C version (MinGW) "6.3.0"
If instead the following output is produced re-check the PATH settings as this output indicates the PATH setting is wrong:
'cobc' is not recognized as an internal or external command, operable program or batch file.
Create the following cobol.bat file in the c:\GnuCOBOL\bin\ folder:

Code: Select all

@ECHO OFF
:: Batch file to run the GnuCOBOL compiler

:: GnuCOBOL compiler env strings
SET COB_MAIN_DIR=c:\GnuCOBOL\
SET COB_CONFIG_DIR=%COB_MAIN_DIR%config
SET COB_COPY_DIR=%COB_MAIN_DIR%copy
SET COB_CFLAGS=-I"%COB_MAIN_DIR%include" %COB_CFLAGS%
SET COB_LDFLAGS=-L"%COB_MAIN_DIR%lib" %COB_LDFLAGS%
SET COB_LIBRARY_PATH=%COB_MAIN_DIR%extras

:: Compile the COBOL file provided
cobc.exe -x %1
IMPORTANT NOTE:
If the installation folder used in the earlier step was changed then this batch file will need to be changed to match that new installation folder.

5. Using the Options, Document Types menu edit the COBOL Document Type and in the Compiler section enter in the following compiler command:

Code: Select all

cobol.bat "$fn"
6. Create a new test.cob file in the c:\temp folder using the following code:

Code: Select all

        id division.
        program-id. hellow.
        procedure division.
            display 'GnuCOBOL - Hello world.'.
7. With the file as the active document use the Zeus Compiler, Compile menu to run the COBOL compiler.

8. After the compiler runs use the Macros, Execute 'test.exe' menu to run the file and the following output should be produced:
GnuCOBOL - Hello world.
IMPORTANT NOTE:
When running the compile an error similar to the following might be produced:
In file included from C:/Utilities/Perl/c/i686-w64-mingw32/include/stddef.h:7:0,
from C:/Utilities/Perl/c/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
from c:\GnuCOBOL\include/stdio.h:69,
from C:\Users\Jussi\AppData\Local\Temp\cob83248_0.c:8:
C:/Utilities/Perl/c/i686-w64-mingw32/include/crtdefs.h:123:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
__MINGW_EXTENSION typedef __int64 __time64_t;
^
C:/Utilities/Perl/c/i686-w64-mingw32/include/crtdefs.h:138:9: error: unknown type name '__time64_t'
This can happen when an older version of the GCC compiler is installed on the machine.

Reading the error it is clear the GnuCOBOL compiler has picked up the stddef.h file from this location:
C:\Utilities\Perl\c\i686-w64-mingw32\include\stddef.h
However it should have found the the GnuCOBOL installation version of that file found here:
C:\GnuCOBOL\lib\gcc\mingw32\6.3.0\include\stddef.h
Cheers Jussi
Post Reply