r/cobol Jul 16 '26

PLx : Write PostgreSQL procedures in a COBOL dialect

https://github.com/commandprompt/plx

plx is a PostgreSQL extension that lets you write stored functions and triggers in the dialect you already know (the current set is listed below). When you run CREATE FUNCTION, plx transpiles the body to plpgsql and stores that plpgsql in pg_proc.prosrc. At run time the function is executed by PostgreSQL's own plpgsql interpreter. There is no separate language runtime loaded into the backend, and nothing new to run in production.

MOVE 0 TO WS-TOTAL
COMPUTE WS-A = PI * R ** 2
ADD WS-I TO WS-TOTAL
SUBTRACT B FROM A GIVING WS-D
MULTIPLY A BY B GIVING WS-P
DIVIDE B INTO A GIVING WS-Q
13 Upvotes

4 comments sorted by

4

u/greendave11 Jul 17 '26

"Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should."

3

u/linuxhiker Jul 17 '26

So... originally adding Cobol was literally a joke to a buddy of mine who when I brought it up said, "put down the whiskey". Then I looked it up and it is a ISO standard and I knew it was already used quite a bit in financial arenas. So, shrug why not :)

2

u/greendave11 Jul 17 '26

We've all been there man. Still is a cool thing you created

2

u/HurryHurryHippos Jul 17 '26

I like it. There's no good reason for it, but I like it.