Integrating Visual COBOL with PHP

[Migrated content. Thread originally posted on 20 January 2011]

Question from Chris B on Twitter during the R3 Launch Webcast:

Is it easy to integrate Cobol objects with php in a similar manner to C# or Java?

Comments?
  • Yes, it is. Through Micro Focus Enterprise Cloud Services we have seen folks build CICS COBOL transactions (with the requisite 3270 terminal interface) that map to RESTful Web services. MF ECS provides the mapping between screen and Web services, the Micro Focus Server Enterprise Edition (CICS, IMS, JCL runtime) and hosting of the PHP enviroment (Apache HTTPD). Contact us at cloudservices@microfocus.com to see a demo of OpenCart.com(open source PHP shopping cart application) that invokes COBOL transactions -- all of it running in the cloud on MF ECS.
  • Verified Answer

    Aside from integration through cloud services, PHP could integrate with Visual COBOL thru services and probably calls to native .DLLs or shared libraries as well if PHP has that capability...which I beleive it does. What we've done for COBOL and .NET is extended the language to actually be a .NET language...i.e. compiling source code to MSIL. In the same way for Java we're generating java byte code from COBOL source so it can run in a JVM. The integration to PHP at this point would not be at that level but still possible as I indicated early in my response.
  • PHP on Windows can directly instantiate and invoke .NET assemblies. See the PHP documentation for the DOTNET class:

    http://us.php.net/manual/en/class.dotnet.php

    It can also instantiate and invoke COM objects:

    http://us.php.net/manual/en/class.com.php

    I haven't tried either of these with Visual COBOL, but offhand I'd expect them to work. Obviously this would require PHP running on a Windows server, with the Visual COBOL runtime installed.

    For PHP on a non-Windows server, you'd have to use one of the service mechanisms (eg SOAP) that have already been discussed.