Build system - COBOL

Plugins for SynWrite and CudaText...
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

i tried to download GnuCOBOL from
https://sourceforge.net/projects/gnucob ... cobol/3.2/
i got file gnucobol-3.2-rc2_win.zip
but it don't have the .exe file in it.
where to download .exe file?
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Alexey

I've tried to amend the COBOL build.system (now renamed as GnuCOBOL) as follows:

Code: Select all

{
  "file_patterns": ["file_patterns": ["*.cob", "*.cbl", "*.cpy"],
  "name": "Compile",
  "cmd": [ "cobc -x -std=mf  c:\workarea\gnucobol\beeb\", "$file_name"],
  "working_dir": "$file_path",
  "file_regex": "^([^:]+):([0-9]+):"
  "variants": [
    {
      "name": "Run",
      "cmd": ["$file_base_name"]
    }
}
When I do Runner -> Build with this I get the message 'No command "Build" in build-system GnuCOBOL...'. I am trying to compile BBCB.CBL. There s a message 'Opened BBCB.CBL' so it's finding the target but then states: 'No build system(s) found for lexer COBOL' and then 'No command "Build" in build-system GnuCOBOL...'

I must be close to the solution ;-)
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Alexey

Ref your attempt to download GnuCOBOL the SourceForge web site only appears to have files of the source code. Windows pre-built binaries are at https://www.arnoldtrembley.com/GnuCOBOL.htm. The file you need is GC32-BDB-rc2-rename-7z-to-exe.7z . After downloading rename to file to *.exe (drop the .7z) and it will install in the appropriate folders .

The compiler (cobc.exe) will be in C:\GnuCOBOL\bin
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

your json file has many errors. i fixed them. my final file
C:\CudaText\data\buildsystems\cobol.sublime-build
is

Code: Select all

{
  "file_patterns": ["*.cob", "*.cbl", "*.cpy"],
  "name": "Compile",
  "cmd": ["c:\\GnuCOBOL\\bin\\cobc.exe", "-x", "-std=mf", "c:\\work", "$file_name"],
  "working_dir": "$file_path",
  "file_regex": "^([^:]+):([0-9]+):",
  "variants": [
    {
      "name": "Run",
      "cmd": ["$file_base_name"]
    }
    ]
}
i created fake Cobol file C:\Work\new.cbl

Code: Select all

procedure aa;
input dd
and i run the command in the Cud's menu: "Plugins / Runner / Build" and it shows in the bottom panel of Cud:
-- [10:05:46] Building: cobol: new.cbl
-- Command: ['c:\\GnuCOBOL\\bin\\cobc.exe', '-x', '-std=mf', 'c:\\work', 'new.cbl']
-- Working dir: C:\Work
configuration error:
/mingw/share/gnucobol/config\mf.conf: No such file or directory
/mingw/share/gnucobol/config\default.conf: No such file or directory
-- Done (0.2s), return code: 1
yes , this is close to solution now.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

if you will get the OK results from Cobol compiler (ie from the Cud build system),
show your file data\buildsystems\cobol.sublime-build
so i can post the good into to our Wiki.
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Alexey

Thanks - I'll try out your suggestions. Incidentally I forgot to mention that a number of GnuCOBOL folders need to be set if, as I often do, a standalone compile is run. I use this batch file:

Code: Select all

set Path=c:\gnucobol\bin
set COB_CONFIG_DIR=c:\gnucobol\config
set COB_COPY_DIR=c:\gnucobol\copy
set COB_INCLUDE_PATH=c:\gnucobol\include
set COB_LIB_PATH=c:\gnucobol\lib
cobc -x -std=mf %1
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Alexey

I'm trying to compile BBCB.CBL which is in folder c:\workarea\gnucobol\beeb so I amended the 'cmd' line in the build to
"cmd": ["c:\\GnuCOBOL\\bin\\cobc.exe", "-x", "-std=mf", "c:\\workarea\\gnucobol\\beeb", "$file_name"],
Doing Plugins -> Runner -> Build gives the following messages:
-- [14:19:25] Building: GnuCOBOL: BBCB.cbl
-- Command: ['c:\\GnuCOBOL\\bin\\cobc.exe', '-x', '-std=mf', 'c:\\workarea\\gnucobol\\beeb', 'BBCB.cbl']
-- Working dir: C:\WORKAREA\GnuCOBOL\BEEB
configuration error:
mf.conf: No such file or directory
default.conf: No such file or directory
-- Done (1.0s), return code: 1
So the build system is correctly finding the file to be compiled. I suspect the configuration error is because the paths that I outlined earlier have not been defined i.e.
set Path=c:\gnucobol\bin
set COB_CONFIG_DIR=c:\gnucobol\config
set COB_COPY_DIR=c:\gnucobol\copy
set COB_INCLUDE_PATH=c:\gnucobol\include
set COB_LIB_PATH=c:\gnucobol\lib
The files mf.conf and default.conf are found in c:\gnucobol\config (set COB_CONFIG_DIR=c:\gnucobol\config). So is there a way to define these file paths?
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

https://github.com/Alexey-T/CudaText/issues/5136
i have to post on github. because SF.net bans my reply on this forum.
reply here on forum.
main Alexey
Posts: 2265
Joined: 25.08.2021 18:15

Post by main Alexey »

i tested build-system on this file and compiler makes the test.exe.

Code: Select all

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. IDSAMPLE.
000300 ENVIRONMENT DIVISION.
000400 PROCEDURE DIVISION.
000500     DISPLAY 'HELLO WORLD'.
000600     STOP RUN.
running test.exe gives error about missing libcob-4.dll.
Paolo_R
Posts: 24
Joined: 23.01.2021 01:11

Post by Paolo_R »

Alexey

The runcobol.cmd and modified build system works - the warnings and error are things that I will modify in my program.

Many thanks for your assistance :D
Post Reply