Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
wilfredHagenaars
New Member.
693 views

API sample cobol program???

Does some one have a API cobol program.

I want to make a connection with Mailchimp or channable or Twinfield etc etc. 

 

 

 

https://support.channable.com/hc/en-us/categories/115000528869-Marketplaces-Orders

0 Likes
4 Replies
DougP Outstanding Contributor.
Outstanding Contributor.

RE: API sample cobol program???

There are sample programs here demonstrating COBOL calling the Windows API:
supportline.microfocus.com/.../GUIsampleprograms.aspx
Look at GetEnvironment, key_status, auto-min-win, and flash-window. While they do not connect with any of those you mention you'll see how to load the dll and call methods.
0 Likes
ruudh
New Member.

RE: API sample cobol program???

Hello Doug, these sample programs are at least 12 years old. Isn't time to put some new sample programs for Acucobol on the website? That would give us, the Acucobol developers, the idea that Acucobol is still alive.....
Ed1 Absent Member.
Absent Member.

RE: API sample cobol program???

Note!
Response comes back in memory. Max response text here 1 mb.


78 LENGTH-REQUEST-FILE VALUE 2097152. | 2048k.
77 GET-REQUEST-FILE PIC X(LENGTH-REQUEST-FILE).
77 http-destination-url pic x(512) value spaces.

01 http-get-post pic 9(01) value 0.
88 http-get value 0.
88 http-post value 1.
88 http-put value 2.
88 http-delete value 3.

111114 78 ANSWER-LENGTH VALUE 1048576. | 1024k

01 RESET-VELDEN.
03 ANSWER PIC X(ANSWER-LENGTH).

*----------------------------------------------------------------
CALL-XML-HTTP60 SECTION.
BEGIN.
if http-put .....
MOVE your-api-command TO http-destination-url
END-IF.

CREATE @XMLHTTP60 HANDLE IN MS-XML-OBJECT.

IF http-get
MODIFY MS-XML-OBJECT @Open("GET",
http-destination-url, 0)
END-IF.
IF http-post
MODIFY MS-XML-OBJECT @Open("POST",
http-destination-url, 0)
END-IF.
IF http-put
MODIFY MS-XML-OBJECT @Open("PUT",
http-destination-url, 0)
END-IF.
IF http-delete
MODIFY MS-XML-OBJECT @Open("DELETE",
http-destination-url, 0)
END-IF.

IF http-post OR http-put
MODIFY MS-XML-OBJECT @setRequestHeader
("Content-Type","application/xml")

* MODIFY MS-XML-OBJECT @setRequestHeader
* ("Content-Type",
* "application/x-www-form-urlencoded")

* MODIFY MS-XML-OBJECT @setRequestHeader
* ("Content-Type",
* "text/xml; charset=utf-8")
* MODIFY MS-XML-OBJECT @setRequestHeader
* ("Authorization", ACCESS-TOKEN)
* MODIFY MS-XML-OBJECT @setRequestHeader
* ("SOAPAction", API-SOAP-ACTION)
* MODIFY MS-XML-OBJECT @setRequestHeader
* ("Content-Type","application/xml")

MODIFY MS-XML-OBJECT @Send(GET-REQUEST-FILE(01:ip1))
END-IF.

IF http-get OR http-delete
MODIFY MS-XML-OBJECT @Send("")
END-IF.

INITIALIZE WS-STATUS.
INQUIRE MS-XML-OBJECT @Status IN WS-STATUS
INQUIRE MS-XML-OBJECT @responseText IN ANSWER

DESTROY MS-XML-OBJECT.
ENDS.
EXIT.
0 Likes
Ed1 Absent Member.
Absent Member.

RE: API sample cobol program???

Note.
You have to create a .def file from msxml6.dll

* OLE object definitions for MSXML2
* This is a 32-bit object
* Generated by axdefgen version 9.2.1 + ECN-4245
* Generated: Tuesday, August 01, 2017
* Typelib..: C:\Windows\SysWOW64\msxml6.dll
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.