Menu

How to Configure tasks.json for Superbol with EXEC SQL on Windows 11?

2025-11-14
2025-11-14
  • compiletaro

    compiletaro - 2025-11-14

    I’ve set up VS Code on my Windows 11 environment and started using Superbol.
    I’m trying to figure out how to modify tasks.json when using EXEC SQL.

    Here’s my current setup:
    ・I have a COBOL source file: SQL_TEST.cob.
    ・I created a tasks.json file (attached).

    Currently, I follow these steps manually:

    1. Run SQL_TEST.cob through GixSQL to generate SQL_TEST.cbsql.
    2. Build the generated SQL_TEST.cbsql.
    3. Execute the resulting SQL_TEST.exe to display the output.

    What I’d like to achieve:
    ・Simply select SQL_TEST.cob, build it, and immediately display the result (without manually running the intermediate steps).

    The database connection uses PostgreSQL.
    Could anyone provide advice or an example of how to configure tasks.json to accomplish this?

     
    • Simon Sobisch

      Simon Sobisch - 2025-11-14

      just some hints:
      * for "compile and run" you want to do one of the following:
      * include the run by adding the cobc argument --job (or -j)
      * have a Makefile with a "phony" run target that depends on the executable which depends on the source file(s)
      * vscode way:
      * have a separate definition "compile" that does the compilation
      * have a separate definition "run" that does the execution
      * have a "compile and run" that just chains both in order
      * to include the preprocessor
      * create a command/batch script that does the precompile depending on the file name, then the rest
      * create a Makefile which does the precompile automatically depending the filename / extension and just execute that in the build task
      * vscode way: use only default build tasks and jsut execute "build" - make the build task to be used depending on the filename, see https://stackoverflow.com/a/79225170/5027456 for a full example

      I personally prefer the Makefile setup:
      * you can do everything from the command line or vscode or other editors
      * you have single place to add options like include paths and arguments
      * if your setup is more complex then everything else becomes very complex very fast... (starting by "compile this module, then run another program which then will execute this one)
      * you can easily make the options depending on the filename/extension
      * you can use wildcards and translations to define what is needed
      * you can use parallel compilation easily
      * if there's no need to rebuild something this isn't done (but you can either "clean" all/parts or tell make to calculate the dependency in a way that "something is so new it needs to be redone")
      * you have fine grained control and can easily do things as preprocessing as-needed
      * if you use static linking (multiple programs compiled into a binary) then I'd not do it by hand
      * you can use cobc's automatic dependency file generation to only compile if a dependency (=source file or used copybooks) changed; with preprocessing that also means it will skip the gixsql call if the source file did not change while recompiling the preprocessed file if a used copybook changed
      * you can have much more targets, including "all" (compile the whole application"), compile whole modules (related set of programs)

      A complex Makefile which covers a reasonable complex COBOL project using static calls and linking and compiling/running both the application and unit tests and executes java for file extraction and automated downloads all based on file names and full automatic dependency tracking (change one copybook, then ask make to run a unit test and it will compile the test and application programs that are used in that run that use the copybook and will then relink old and new objects together, before doing the unit test) can be seen at https://github.com/meyfa/CobolCraft/blob/main/Makefile (you likely find easier Makefiles here).

       
      👍
      2

Anonymous
Anonymous

Add attachments
Cancel