GixSQL, COBOL and FreeBSD

This is more of a small bookmark for my own sake, rather than a full article.

I created a tiny repository with working GnuCOBOL, GixSQL and SQLite examples: gnucobol-gixsql-sqlite-examples

It is intentionally small.

There is one SELECT example, one INSERT example, a tiny SQLite schema, a Makefile, and some notes about the things that were harder to discover than I expected. Not a framework, not a full tutorial, not a polished “this is how you should do it” document.

More a trace.

This came out of Project Quiet Ground.

One of the small promises I made to myself there was to keep data contracts plain and understandable. CSV. COBOL line sequential files. SQLite. DBF. Boring formats, in the best possible sense. Files and databases that can be inspected, copied, moved, imported, exported, and understood without needing to summon a whole infrastructure pantheon.

CSV and COBOL line sequential files were already within reach.

SQLite was the piece I wanted to prove from COBOL.

I did not want to write small C wrapper modules around SQLite calls if I could avoid it. That would have worked, but it would also have felt like stepping outside the contract too early. GixSQL already existed as an embedded SQL path for GnuCOBOL, so I wanted to see whether I could make that route work in practice.

It did work. But it took some archaeology.

The practical information was scattered across source trees, old examples, forum posts, GitHub workflows, patches, and trial and error. GixSQL is also rather strict about the COBOL source it accepts. Fixed-format style matters. Leading spaces matter. Long lines are not your friend. Comments can confuse the preprocessor and produce generated COBOL that then fails at the cobc stage.

The small public repository exists because I wanted to preserve the path that worked.

Not the entire cave system. Just the string through the part I actually crossed.

For current systems I used Simon Sobisch’s fork of GixSQL, rather than the original upstream repository, which appears inactive for practical purposes. For my needs, I built only the SQLite backend. The examples assume GixSQL installed under /usr/local, with the copybooks under /usr/local/share/gixsql/copy.

The build path is simple once everything is in place:

gixpp -> generated .cbsql -> cobc

For example:

select.cbl -> gixpp -> select.cbsql -> cobc
insert.cbl -> gixpp -> insert.cbsql -> cobc

That is the sort of tiny detail that matters when something fails.

The repository also includes FreeBSD notes and a small local patch, because GixSQL did not build out of the box for me there.

And quietly, that is another reason for this bookmark.

I made GixSQL work far enough on FreeBSD to run these SQLite examples.

Not a grand port. Not a dramatic achievement. No trumpets, no conference stage, no heroic lighting.

But still: a small badge of honour.

In the architecture I have in mind, Linux Mint and FreeBSD are the more comfortable backend environments. They are places where SQLite makes sense for the fuller Project Quiet Ground work. Alpine, on the other hand, belongs to smaller, more appliance-shaped experiments, where standard COBOL structures and line sequential files are often a better fit, like on the PursePC. I do not want the small systems to carry SQLite just because the larger ones can.

So this repository is not meant to be universal.

It only says: here is one small working path.

GnuCOBOL. GixSQL. SQLite. Linux Mint. FreeBSD.

A read example. An insert example. A schema. A Makefile. Notes from the small dragons encountered on the way.

I am not presenting this as expert documentation. It is the result of hammering things until they worked, then writing down the dents.

If it saves someone else an evening of compiler errors and scattered clues, it has done its job.

Repository:

https://codeberg.org/tarastella/gnucobol-gixsql-sqlite-examples

2026-06-22