0

I recently reinstalled VSCode having deleted it some time ago. I created a task to compile GnuCOBOL. However when I look at tasks.json my GnuCOBOL entries are there but also entries for the Ada language.

I've no idea how they got in there and when I want to run a (GnuCOBOL) task (Terminal -> Build task) all the options are prefixed with Ada. So I deleted the Ada references in tasks.json - and ran Ada.build task assuming that my GnuCOBOL compile would run. Instead a I got these messages in Terminal:

Executing task: gprbuild -cargs -gnatef 

gprbuild: The term 'gprbuild' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

 *  The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command gprbuild -cargs -gnatef" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

So I would like to go back to square one - delete my tasks.json and, hopefully, all those prefixed with Ada and create a new tasks.json containing just the GnuCOBOL stuff.

Is there a recommended way to do this? Thanks

paoloricardo
  • 1,353
  • 2
  • 11
  • 10

2 Answers2

0

OK I've found out how to delete languages so I've sorted that out. I also have created a Task for GnuCOBOL compiles.

The task is supposed to compile a program (in this case BBCB.CBL) and when tun in the Terminal gives this message:

"Executing task in folder VSCodium: cobc -x -std=mf C:\WORKAREA\GnuCOBOL\BEEB\BBCB.cbl "

and shows a tick implying success but BBCB.EXE is not produced (the purpose of cobc -x). This works perfectly when run in a standalone terminal with a batch file. So why does it not work in VSCode?

paoloricardo
  • 1,353
  • 2
  • 11
  • 10
  • You likely either have not set the GnuCOBOL environment (PATH variable containing cobc.exe or a wrapper) - in which case the build command should fail - or have not set the working directory what you expect it to be. You may want to explicit specify the output path with cobc's '-o' option and/or use it's '--verbose' option to ... be more verbose, telling you what it does in detail. – Simon Sobisch Jul 09 '23 at 08:04
  • To be a useful answer: please provide the json task definition you use (and if it does not include a problemMatcher try to include that first). – Simon Sobisch Jul 09 '23 at 08:05
  • Sorry my reply got posted above. – paoloricardo Jul 10 '23 at 00:09
  • Aha, I've just found that the compiled .exe (BBCB.EXE) has been placed in c:\workarea\vscodium. I'll try the -o option. – paoloricardo Jul 10 '23 at 00:16
  • Added this to tasks.json: "-o c:\\workarea\\gnucobol\\beeb\\beeb.exe", but no .exe s produced. I really not au fait with json :-) – paoloricardo Jul 10 '23 at 00:24
  • It would be two options in json, one for the -o and one for the output file. But you can likely drop the folder and `-o` completely, when using `"options": { "cwd": "${fileDirnameBasename}" }` - this way you do in the task definition what you likely do in the cmd window - going to that directory first. – Simon Sobisch Jul 10 '23 at 10:49
  • Sorry --verbose output is too long. – paoloricardo Jul 11 '23 at 02:33
  • Added "cwd". Got 'Executing task in folder VSCodium: cobc -x -std=mf C:\WORKAREA\GnuCOBOL\BEEB\BBCB.cbl ', 'Task succeeded' but BBCB.EXE put in C:\WORKAREA\VSCodium not C:\WORKAREA\GnuCOBOL\BEEB\ – paoloricardo Jul 11 '23 at 02:38
  • I deleted C:\WORKAREA\VSCodium and its contents which included tasks.json. Running the COBOL task recreated C:\WORKAREA\VSCodium and placed BBCB.EXE there plus tasks.json. – paoloricardo Jul 11 '23 at 06:45
  • This is Q+A, not a chat... What do you think about opening an issue in the extensions issue tracker with the full current state, then we find the solution there and get them back here to post the solution? – Simon Sobisch Jul 12 '23 at 06:10
  • I'm happy to open an issue in the issue tracker. Where do I find it? – paoloricardo Jul 13 '23 at 00:25
  • You commonly find the issue of any vscode extension when clicking on it in the extension view, then on its details on the right on "Repository". – Simon Sobisch Jul 14 '23 at 10:42
  • Well I asked a question on the extensions issue tracker and I was told it was only for bugs and to use StackOverflow for questions. So I'll be using VSCode as an editor with batch files for compiling and linking. – paoloricardo Jul 18 '23 at 23:57
  • Hm, this is the extension's issue tracker: https://github.com/OlegKunitsyn/gnucobol-debug/issues - where is your question exactly? – Simon Sobisch Jul 19 '23 at 10:43
  • I put it here: https://github.com/microsoft/vscode/issues/187891#issuecomment-1638320701 – paoloricardo Jul 20 '23 at 00:28
  • That's the vscode issue tracker, but you have a question to a specific extension - best to check in the issue tracker of that extension. – Simon Sobisch Jul 20 '23 at 05:26
0

I'm trying to compile this:

c:\workarea\gnucobol\beeb\bbcb.cbl

My task definition is:

{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
 "version": "2.0.0",
 "options": {
   "env": {
     "PATH": "\\gnucobol\\bin",
     "COB_CONFIG_DIR": "c:\\gnucobol\\config",
     "COB_COPY_DIR": "c:\\gnucobol\\copy",
     "COB_INCLUDE_PATH": "c:\\gnucobol\\include",
     "COB_LIB_PATH": "c:\\gnucobol\\lib",
   }
 },
 "tasks": [
  {
    "label": "GnuCOBOL - Compile (single file)",
    "type": "shell",
    "command": "cobc",
    "args": [
      "-x",
      "-std=mf",
 //     "-t${fileBasenameNoExtension}.LST",
 //     "-tBBCB.lst",
      "${file}"
    ],
     "problemMatcher" : "$gnucobol-cobc"
  }
 ]
}

As I said in my earlier posting I get this message:

Executing task in folder VSCodium: cobc -x -std=mf C:\WORKAREA\GnuCOBOL\BEEB\BBCB.cbl

which seems to indicate that BBCB.CBL is being found - but an .exe file is not being created.

Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38
paoloricardo
  • 1,353
  • 2
  • 11
  • 10