Discussion:
COBOL and socket io
(too old to reply)
SRSeedBurners
2021-12-27 21:54:11 UTC
Permalink
I have a test tool originally written in COBOL that I use to send transactions to our servers which is done via IPC. I now need to simulate sending transactions to our systems the same way outside vendors via a socket connection. I am not finding that COBOL supports tcpip socket io. If that is true, I was considering writing a C module to handle the tcpip and CALL'ing it from the COBOL test tool. However, I'm also finding Guardian COBOL does not support mixed language support as it does in OSS. So my only other option, re-write my test tool in C so I can use the Guardian socket library or move it to OSS and write an OSS C module and call it. Being a non-COBOL'er am I missing something?
Keith Dick
2021-12-28 02:02:14 UTC
Permalink
I have a test tool originally written in COBOL that I use to send transactions to our servers which is done via IPC. I now need to simulate sending transactions to our systems the same way outside vendors via a socket connection. I am not finding that COBOL supports tcpip socket io. If that is true, I was considering writing a C module to handle the tcpip and CALL'ing it from the COBOL test tool. However, I'm also finding Guardian COBOL does not support mixed language support as it does in OSS. So my only other option, re-write my test tool in C so I can use the Guardian socket library or move it to OSS and write an OSS C module and call it. Being a non-COBOL'er am I missing something?
Not sure what led you to believe that mixed-language is not supported in Guardian Native compilers.
Both the 'NonStop COBOL Manual for TNS/E and TNS/X Programs' and the 'C/C++ Programmer's Guide for NonStop Systems' say that both can be mixed.
You can't use COBOL85, you have to use Native COBOL (ECOBOL or XCOBOL, depending on your system).
You also have to use Native C (NMC or CCOMP, depending on your system). You will needt to use eld or xld to link them together.
You could also do all builds in OSS, or on Windows using the cross compilers. All are documented in the manuals.
Best of luck,
Bill
In addition to all that Bill said:

If you want to build a Guardian program in OSS, you can do so by including the -Wsystype=guardian directive for the compiler to get it to create object files for running as Guardian processes. Make sure any libraries you reference explicitly are for Guardian when doing such a build from OSS.

I'm not sure why Bill said you couldn't use COBOL85. If the Guardian sockets library is not available as a TNS (code 100) file, then that would prevent using it from a COBOL85 program, but I think the Guardian sockets library is old enough that it originally was a TNS file. Perhaps they don't distribute the TNS version any more?

Anyway, you should be able to do what you want as a mixed COBOL and C program. If you still see some barrier, post again with more specifics about what seems to be a problem, and I am sure we will be able to help.
Bill Honaker
2021-12-28 23:18:15 UTC
Permalink
Post by Keith Dick
I have a test tool originally written in COBOL that I use to send transactions to our servers which is done via IPC. I now need to simulate sending transactions to our systems the same way outside vendors via a socket connection. I am not finding that COBOL supports tcpip socket io. If that is true, I was considering writing a C module to handle the tcpip and CALL'ing it from the COBOL test tool. However, I'm also finding Guardian COBOL does not support mixed language support as it does in OSS. So my only other option, re-write my test tool in C so I can use the Guardian socket library or move it to OSS and write an OSS C module and call it. Being a non-COBOL'er am I missing something?
Not sure what led you to believe that mixed-language is not supported in Guardian Native compilers.
Both the 'NonStop COBOL Manual for TNS/E and TNS/X Programs' and the 'C/C++ Programmer's Guide for NonStop Systems' say that both can be mixed.
You can't use COBOL85, you have to use Native COBOL (ECOBOL or XCOBOL, depending on your system).
You also have to use Native C (NMC or CCOMP, depending on your system). You will needt to use eld or xld to link them together.
You could also do all builds in OSS, or on Windows using the cross compilers. All are documented in the manuals.
Best of luck,
Bill
If you want to build a Guardian program in OSS, you can do so by including the -Wsystype=guardian directive for the compiler to get it to create object files for running as Guardian processes. Make sure any libraries you reference explicitly are for Guardian when doing such a build from OSS.
I'm not sure why Bill said you couldn't use COBOL85. If the Guardian sockets library is not available as a TNS (code 100) file, then that would prevent using it from a COBOL85 program, but I think the Guardian sockets library is old enough that it originally was a TNS file. Perhaps they don't distribute the TNS version any more?
Anyway, you should be able to do what you want as a mixed COBOL and C program. If you still see some barrier, post again with more specifics about what seems to be a problem, and I am sure we will be able to help.
Keith, I think I meant you couldn't use it with Native C... and also my thoughts included OSS which doesn't support TNS.
But of course one can easily use C, COBOL85 and BIND, if that lowers the learning curve.

For a program to run in OSS, another thing to consider is 'native' POSIX TCP/IP calls rather than the Guardian sockets.

There are many, many ways to solve the OP's (SRSeedBurners) dilemma.
Bill
Randall
2021-12-29 19:56:50 UTC
Permalink
Post by Bill Honaker
I have a test tool originally written in COBOL that I use to send transactions to our servers which is done via IPC. I now need to simulate sending transactions to our systems the same way outside vendors via a socket connection. I am not finding that COBOL supports tcpip socket io. If that is true, I was considering writing a C module to handle the tcpip and CALL'ing it from the COBOL test tool. However, I'm also finding Guardian COBOL does not support mixed language support as it does in OSS. So my only other option, re-write my test tool in C so I can use the Guardian socket library or move it to OSS and write an OSS C module and call it. Being a non-COBOL'er am I missing something?
Not sure what led you to believe that mixed-language is not supported in Guardian Native compilers.
Both the 'NonStop COBOL Manual for TNS/E and TNS/X Programs' and the 'C/C++ Programmer's Guide for NonStop Systems' say that both can be mixed.
You can't use COBOL85, you have to use Native COBOL (ECOBOL or XCOBOL, depending on your system).
You also have to use Native C (NMC or CCOMP, depending on your system). You will needt to use eld or xld to link them together.
You could also do all builds in OSS, or on Windows using the cross compilers. All are documented in the manuals.
Best of luck,
Bill
If you want to build a Guardian program in OSS, you can do so by including the -Wsystype=guardian directive for the compiler to get it to create object files for running as Guardian processes. Make sure any libraries you reference explicitly are for Guardian when doing such a build from OSS.
I'm not sure why Bill said you couldn't use COBOL85. If the Guardian sockets library is not available as a TNS (code 100) file, then that would prevent using it from a COBOL85 program, but I think the Guardian sockets library is old enough that it originally was a TNS file. Perhaps they don't distribute the TNS version any more?
Anyway, you should be able to do what you want as a mixed COBOL and C program. If you still see some barrier, post again with more specifics about what seems to be a problem, and I am sure we will be able to help.
Keith, I think I meant you couldn't use it with Native C... and also my thoughts included OSS which doesn't support TNS.
But of course one can easily use C, COBOL85 and BIND, if that lowers the learning curve.
For a program to run in OSS, another thing to consider is 'native' POSIX TCP/IP calls rather than the Guardian sockets.
There are many, many ways to solve the OP's (SRSeedBurners) dilemma.
Bill
The last time I tested, the GUARDIAN socket calls, like accept_nw, could not be used from OSS. The same applies for threaded socket calls not being available to GUARDIAN. There was one RVU where the threaded calls worked by accident but no longer. Socket calls are personality-specific.
SRSeedBurners
2021-12-28 10:53:08 UTC
Permalink
Not sure what led you to believe that mixed-language is not supported in Guardian Native compilers.
Thanks Bill. It was the section 'Mixed-Language Programs'. It specifically starts off by stating "In the OSS environment, you can write mixed-language programs." which made me assume you cannot do this on Guardian. I never made it to the Calling other Programs and Routines where it's specifically referring to Guardian side only.

Speaking of cross-compilers, I have a real good question for that too but will save for a top post.
Loading...