
A Node.js bridge for COBOL - reimertz
https://github.com/IonicaBizau/node.cobol
======
skissane
I wonder, is this actually used anywhere? Or is it just for fun?

I expect in some bank somewhere, node.js-COBOL integration really happens, but
more commonly using web services (REST or SOAP). Take the legacy COBOL
application, turn it into a web service, then clients like node.js can call
it. Popular COBOL application frameworks – such as CICS and Tuxedo – include
support for writing SOAP and REST web services in COBOL, which are generally
used to add web service endpoints to existing COBOL applications.

~~~
brianwawok
I know of places writing COBOL that gets turned to Java and deployed like
that. Sigh legacy apps :)

~~~
chx
Please give us a list of workplaces not to apply to.

~~~
azemetre
I'd totally write COBOL if it paid over $500K per year. Which it may very well
soon when enough people retire.

~~~
karmajunkie
I cut my teeth writing cobol back during the Y2K thing... I think I might have
been the only college student they interviewed that had cobol on the resume.
It was 20 years ago but I don't remember it being any more painful than some
of the other crap I've had to deal with over the years. I'd definitely brush
it off for $500k :)

------
rcarmo
Up next, on 11'o'clock news:

"JavaScript developer breaks all mainframes on the planet by withholding
LEFTPAD.CBL"

~~~
maxaf
Well, now it _has to_ happen just for comedic value.

------
hk__2
Is it really a "bridge" when all you do is shell-out to a Node interpreter?
You can’t even call a function and get its return value.

------
0x0
I'm no cobol expert, but does this just shell out to

    
    
      'node -e "' + code + '"' 
    

? What if code contains a " ?

[https://github.com/IonicaBizau/node.cobol/blob/master/lib/no...](https://github.com/IonicaBizau/node.cobol/blob/master/lib/node-
exec.cbl)

~~~
squeaky-clean
I've never used cobol, but I'm pretty sure doing so would fail. "node-exec-
path.cbl" is for this, you can give it a path to a script to run. The example
uses it as

    
    
        CALL 'EXEC_NODEJS_FILE' USING "example/server.js".
    

Alternatively, you can escape double quotations to \" and they'll work with
node -e (I'm pretty sure it's not doing this automatically though).

I think I found another bug too, my only experience with cobol is the 10
minutes spent trying to understand this, so maybe someone can explain? Since
in EXEC_NODEJS, NODEJS_CODE is defined as "NODEJS_CODE PIC A(100)", doesn't
that limit it to 100 alphabetic characters, so even the example of
"console.log('Hello World!')" would not work because of the period,
parentheses, and exclamation mark?

~~~
ahlatimer
My first job as a developer was writing COBOL (in 2007), and I only did it for
a few months, so grain of salt here. I'm fairly certain PIC A(100) should be
PIC X(100). A is "alphabetic." X is "alphanumeric" but supports ASCII
characters that aren't a-z or 0-9.

That said, COBOL is weakly typed, so you can probably store non-alphabetic
characters in a variable typed as alphabetic (at least without the compiler
correcting you), but it might fail if you try to do certain operations on
them.

~~~
rhizome
Yeah buddy! I was a screen-colorer for a large COBOL app in the mid-late 90s.

------
TimMeade
Wow... This sent a chill up my back. Why? Why? I've tried so hard to forget
those days.

No seriously. I'm sure there is a need for a cobol bridge, just surprised to
see it pop up.

~~~
hk__2
> I'm sure there is a need for a cobol bridge, just surprised to see it pop
> up.

Note it’s a Node bridge, i.e. call Node from COBOL, not the other way around.

~~~
wrong_variable
Almost like COBOL is using a time machine to talk to the future. Reminds me of
Interstellar.

------
int_handler
In case anyone else is wondering like I was about why all the COBOL code is
indented several spaces over: [http://stackoverflow.com/questions/8959489/why-
does-cobol-ha...](http://stackoverflow.com/questions/8959489/why-does-cobol-
have-to-be-indented)

~~~
apaprocki
Still comes in handy... A bit of recent fun :)

[https://github.com/BloombergMedia/whatiscode/pull/20](https://github.com/BloombergMedia/whatiscode/pull/20)

------
asimuvPR
I can't say how useful this might be in the real world, but I appreciate the
out of the box thinking. It could be more useful if you could call Python or
Perl from the COBOL program, but what do I know.

One thing for sure: I will find a way to use this somehow. :)

------
exabrial
Needs COBOLSCRIPT integration:
[http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=tru...](http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&arnumber=882363)

~~~
wrong_variable
quick someone write a left pad module for it !

------
gjm11
At last, a real rival to the wildly popular Cobol on Cogs project:
[http://www.coboloncogs.org/](http://www.coboloncogs.org/)

------
djsumdog
Just because you can doesn't mean you should

------
shrugger
Just the Javascript module the world was waiting on! I'm sure this will have a
meaningful impact! /s

In seriousness: My dad was a COBOL programmer for about 30 years. It would
frustrate him to no end to look upon Javascript programmers and to tell him,
"these guys are going to be working on your code now."

I'd never advocate COBOL or anything, but I'm just saying that it took a
certain breed of person to do it, and that those people aren't around anymore
is a sad thing.

~~~
roscoebeezie
As a 23 year old mainframe programmer who writes COBOL, I couldn't agree with
you more.

~~~
shrugger
Out of curiosity, is it a very lucrative trade anymore? My dad has always
wanted me to learn the trade, I've always assumed it's that paternal 'pass the
baton to the seed' instinct, and I've never bothered because I've always been
afraid that most shops wouldn't give any real consideration to a millenial who
says he can program mainframes.

Has this been similar to your experience? I'm just curious because it's not a
very typical thing, square peg in a round hole sort of situation.

~~~
zcdziura
Not the OP, but I'm of similar age and also a mainframe programmer by trade.
It's a pretty lucrative field to be into, especially because the businesses
which operate mainframes tend to be very large and (mostly) stable
corporations. While not as hip and cool as a Valley startup, there is
something to being well paid and receiving good health and retirement
benefits! =)

Those same corporations are also not blind to the fact that most of their
COBOL workforce will be retiring, en mass, in the coming years, and are quite
desperate to hire anyone willing to learn. My employer paid for me to attend a
3 month training program in order to learn how to use and develop on the IBM
zSeries mainframe. It was a fantastic experience. As well, those same
companies are looking to move as much of their COBOL code off of the mainframe
and onto a distributed, server platform. While you can't beat the sheer power
of Big Iron chugging along through a batch cycle, the CICS user interface
leaves a lot to be desired. It's much more cost and time effective to build a
web interface that talks to a Java middle-layer that lives on the mainframe
(such that it can directly talk with DB2 or some such), compared to designing,
building, and testing a CICS program to do the same thing, yet in a much more
ugly fashion.

~~~
shrugger
Whoa, that is super cool about how they trained you and everything. I have
actually heard bits and pieces of sort of like folklore from my dad about CICS
and other mainframe pop culture, it's always fascinated me in a certain sense.
That there's another whole universe of programming that most people have never
heard of or been involved with.

I'm actually in the process of getting involved with the US Army now (I'm 21)
so that I can get some schooling and stuff done later, but I've thought that I
might spend my off-time for the next few years trying to self-teach myself
NetREXX or something and try to land a job in some MegaCorp. I'm not opposed
to writing code all day in a comfy office chair with full benefits etc,
especially compared to living in a dorm with couple dudes eating Ramen and
trying to conquer Web 4.0 or whatever. Just doesn't appeal to me.

It's reassuring that it's a viable career path, I hadn't thought much about
the new generation of mainframe maintenance, but from what my dad has told me
about some of the people he's worked with it certainly makes sense that these
big corps would be desperate for fresh meat right about now.

~~~
PeCaN
The plus side is that modern mainframes are _really cool_. It's not like
they're still systems from the 70s, they are practically supercomputers with
some of the fastest hardware ever made. (zEC12 was a 6-core, 5.5Ghz processor
with very competitive IPC and monstrous cache; I believe it even had
functional transactional memory too _cough_ Intel _cough_. Now stuff 20 of
those into a computer.)

Downside of course is COBOL, Java, etc. But it's not like it's going anywhere
soon. Nobody really wants to replace millions of lines of COBOL that _work_ ,
and work well.

Writing a compiler for an ML-ish language that targets COBOL would be kind of
amusing. Just because they're stuck with COBOL doesn't mean it has to be hand-
written, right?

Disclaimer: I don't work with mainframes but I know people who do. Friend of
mine quite likes writing assembly for z/Architecture. I don't know if she's
totally sane.

------
riebschlager
This kinda feels like seeing a guy in his 50s on a date with a pretty 22-year-
old.

~~~
mindcrime
What's wrong with that?

~~~
steveax
Violates the "half plus seven" rule [1]

[1]:
[https://en.wikipedia.org/wiki/Age_disparity_in_sexual_relati...](https://en.wikipedia.org/wiki/Age_disparity_in_sexual_relationships#The_.22half-
your-age-plus-seven.22_rule)

~~~
mindcrime
That's just some half-assed lame custom that has no particular justification
behind it. The age of consent is usually no more than 18 pretty much
everywhere (at least in the US, where most of the HN posters seem to be), so I
don't see any problem with a 50 year old guy on a date with a 20-something.

I figure anybody complaining is probably just jealous. But I'm close to 50
than 20 myself, so I'm not exactly unbiased. :-)

------
amga_
WAT

