How can z/OS call a web service?

Tony Borf picture Tony Borf · Apr 4, 2012 · Viewed 12.5k times · Source

I have a COBOL program that needs to get data from a web service. Without using CICS what are my best options? I thought that a C program could read the web service and save it to a file, then the COBOL could read that file. Can COBOL call a web service? The data is about 300mb in size.

Answer

Abacus picture Abacus · Apr 6, 2012

Use the IBM TCP/IP 'EZASOKET' modules

I work for a company with a z/OS system running mostly COBOL, batch (JCL) and CICS. To call webservices, we wrote a module to implement HTTP 1.0 using TCP/IP. With modules

  • EZASOKET
    • GETHOSTBYNAME
    • SOCKET
    • CONNECT
    • WRITE
    • FCNTL
    • READ
    • CLOSE
    • SELECTEX

supplementary modules:

  • EZACIC04 translates EBCDIC to ASCII
  • EZACIC05 translates ASCII to EBCDIC
  • EZACIC06 convert character to bit mask
  • EZACIC08 decode IP address

Since I wrote this for my company, I can't just give out the code. But for reference, it took me 3 days to write the module, and that was with an example to start with that did a partial hacky way of doing it.

You'll need to read through IBM's references to know how to use the EZA modules.