Reputation: 13
I'm trying to integrate some functionality from my company's old system to our new one.
We have some COBOL code running on ACUCOBOL v6.2 . Is there a simple way of making an external http call / or even a non-http call without purchasing AcuToWeb or another software bundle.
Upvotes: 1
Views: 1056
Reputation: 11
The runtime has a utility called "rmnet" built in which can be used with options to do calls to a webserver using http.
See documentation for RMNet Routines.
RMNet Application Programming Interface (API) to emulate a browser that extracts information from a web site or interacts with a web service using SOAP.
RMNet moves data between the a web client, which is typically an ACUCOBOL_GT extend program, and a web server. A Universal Resource Locator (URL) describes the resource. The resource dictates the data format. For example, if submitting data to a web form used by a browser, the data must be formatted to comply with the W3C specification for application/x-www-form-urlencoded. When interacting with a SOAP web service, XML documents are exchanged.
There are samples in the runtime folder under samples have a look for the rmnet folder.
Upvotes: 0
Reputation: 1027
You can use C$SOCKET to establish a socket connection to a server on port 80.
Then you can send a http request, an read the answer.
78 NL value X"0A".
...
call "C$SOCKET" using AGS-CREATE-CLIENT,
port, host giving socket-handle
...
move spaces to zw-get
move 1 to zw-length
string "GET " delimited by size
"YourPath" delimited by size
" HTTP/1.1" delimited by size
NL delimited by size
"HOST: " delimited by size
"YourHost" delimited by size
NL delimited by size
NL delimited by size
into zw-get
with pointer zw-length
end-string
subtract 1 from zw-length
call "C$SOCKET" using AGS-WRITE,
socket-handle, zw-get, zw-length
...
initialize zw-length zw-answer
call "C$SOCKET" using AGS-READ,
socket-handle, zw-answer, zw-length, READ-TIMEOUT
Upvotes: 1
Reputation: 616
I can think of a few ways to handle this:
-Pcurl https://www.google.com/?q=acucobol
for input, or -Pps2pdf > /tmp/pdf-file
as output and send it some postscript.CALL "SYSTEM" USING COMMAND-LINE
Upvotes: 1