Chapter 2: Why Node.js? Advantages vs RPG, Java, Python and PHP

Node.js is going to replace our existing RPG. Will we need to rewrite our ERP System? A new SQL Database? Is our old RPG system redundant?

Let me get this out of the way, because I can already hear the comments being typed: Node.js is not here to replace RPG.

RPG is brilliant at what it does: high-volume, record-level business processing tightly integrated with Db2 for i. Free-format RPG with embedded SQL is a modern, capable language and it's not going anywhere. I still write it every week.

Where Node.js wins

TaskRPGNode.js
Serve a REST/JSON APIPossible (IWS, YAJL, DATA-INTO, CGI) but fiddlyNatural - it's what Node was born for
Parse/produce JSONDATA-INTO/DATA-GEN + a parserBuilt in: JSON.parse / JSON.stringify
Call a third-party web APIHTTP_GET / SQL HTTP functionsfetch() built into Node 18+
Web front endCGI or a separate tierSame language front and back
PackagesLimitedOver two million on npm
HiringShrinking (sadly) poolHuge pool of JavaScript developers

Where RPG still wins

  • Heavy batch processing of millions of records with native I/O.
  • Deep integration with display files, data areas, data queues, commitment control in the ILE way.
  • Existing, proven, battle-hardened code. Never rewrite working code just because something shinier came along.
  • The sweet spot: use both

    The smart move is to put Node.js on the edge - web APIs, integrations, modern UIs - and keep RPG in the core. Node.js calls your RPG programs via itoolkit (we'll do that in Section 4) or calls SQL stored procedures that wrap them. Best of both worlds, and nobody has to fight in the car park.

    {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >