Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sockets and COBOL

I have received a job at a hospital which still uses COBOL for all organizational work, the whole (now 20 Terabyte) database (Which was a homebrew in, guess what, COBOL) is filled with the data of every patient since the last 45 (or so) years.

So that was my story. Now to my question:

Currently, all sockets were (from what I've seen) implemented by COBOL programs writing their data into files. These files then were read out by C++ programs (That was an additional module added in the late 1980s) and using C++ sockets sent to the database.

Now this solution has stopped working as they are moving the database from COBOL to COBOL, yes - they didn't use MySQL or so - they implemented a new database - again in COBOL. I asked the guy that worked there before me (hes around 70 now) why the hell someone would do that and he told me that he is so good at COBOL that he doesn't want to write it in any other language.

So far so good now my question:

  • How can I implement socket connections in COBOL? I need to create an interface to the external COBOL database located at, for example, 192.168.1.23:283.
like image 589
kati Avatar asked Apr 12 '10 21:04

kati


People also ask

What are sockets used for programming?

Sockets allow you to exchange information between processes on the same machine or across a network, distribute work to the most efficient machine, and they easily allow access to centralized data. Socket application program interfaces (APIs) are the network standard for TCP/IP.

What are sockets and its types?

There are two types of Sockets: the datagram socket and the stream socket. Datagram Socket : This is a type of network which has connection less point for sending and receiving packets. It is similar to mailbox.

What is socket and how it works?

Sockets are commonly used for client and server interaction. Typical system configuration places the server on one machine, with the clients on other machines. The clients connect to the server, exchange information, and then disconnect. A socket has a typical flow of events.

Is socket programming still used?

Most current network programming is done either using sockets directly, or using various other layers on top of sockets.


2 Answers

You need to give more information about your OS and compiler.

If you are on IBM z/OS with a Language Environment supported compiler, you can just call the EZASOCK functions from the z/OS communications services. The calls are well documented in their references and have good Cobol examples.

Other platforms will have other options.

In most cases, you can just "CALL" an external module written in whatever language you need, but that a DLL or a sharedLib or whatever.

Can you give some more detail about your environment?

Why don't you just write directly to the database from the Cobol program?

like image 79
Joe Zitzelberger Avatar answered Oct 18 '22 21:10

Joe Zitzelberger


IBM mainframes has two sockets APIs that can be used form COBOL. One for use inside a CICS programs (where there are special thread safety and envrinment considerations) and one for use in ordinary Batch or IMS programs.

The complete TCP/IP functionality is implemented and its reliable enough to handle Credit Card protocols to MVA standards ( I know 'cos Ive done it).

like image 25
James Anderson Avatar answered Oct 18 '22 20:10

James Anderson