views:

110

answers:

4
+3  Q: 

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.
A: 

Most COBOL compiler will allow you to link and call in an object module or DLL. As Kati says I know I can help but need the additional information. I've done this previously from windows to DEC so i know it can be done.

Steve
A: 

Recall that Google is your FRIEND.

The answer will depend heavily on your execution environment.

IBM does claim to have a Sockets API callable from COBOL, as part of CICS for z/OS.

Micro Focus appears to have something.

John R. Strohm
You can (almost) always call external subroutines from COBOL. If the OP can mention the environment I am sure that somebody here may help
belisarius
A: 

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).

James Anderson
+2  A: 

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?

Joe Zitzelberger