# How to call COBOL on IBM i (AS/400) from Integration Server

**URL:** <https://techcommunity.softwareag.com/t/how-to-call-cobol-on-ibm-i-as-400-from-integration-server/237789>\
**Category:** Knowledge base\
**Tags:** Adabas-Natural, Mainframe-Integration, EntireX, REST, issue3-2018-techie, cobol\
**Created:** [July 12, 2018, 6:54am UTC](https://techcommunity.softwareag.com/t/how-to-call-cobol-on-ibm-i-as-400-from-integration-server/237789 "2018-07-12T06:54:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gadi](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/gadi/32/16051_2.png) [@Gadi](https://techcommunity.softwareag.com/u/Gadi)\
**Post date:** [July 12, 2018, 6:54am UTC](https://techcommunity.softwareag.com/t/how-to-call-cobol-on-ibm-i-as-400-from-integration-server/237789/1 "2018-07-12T06:54:36Z")

</div>

# webMethods EntireX

**Calling COBOL from webMethods Integration Server is easy with EntireX. Read how EntireX helps you to connect them with quick results, even without specific COBOL knowledge.**

_Authored by Juergen Lind, Director, Product Management, Adabas & Natural, and Bernhard Fricke, Sr. Lead Software Specialist, Software AG_

## Scenario

You have been using AS/400 (System i®) machines to run your business-critical and mission-critical applications for years.  
Nowadays, new markets need to be addressed. New applications, developed with new technologies, need to be able to use your existing COBOL applications running on AS/400, rather than having to reinvent them at high cost, after the huge investments poured into these core business applications over the years.

You need to connect a variety of COBOL applications to webMethods Integration Server (IS).

## Hands-on example

The COBOL server EMPLOYEE on AS/400 (Fig. 1) needs to be called from IS. With EntireX, you develop the scenario in three phases: &nbsp;1&nbsp;&nbsp;extract &nbsp;2&nbsp;&nbsp;generate &nbsp;3&nbsp;&nbsp;test

 ![](https://global.discourse-cdn.com/techcommunity/original/2X/8/83b8d4ca4d4411148603af3619cb23d812f12b46.jpeg)  
_ **Fig 1:** COBOL Server EMPLOYEE on AS/400 and COBOL Environment for IBM_ _i_ _(AS/400 Operating System)_

Before you start the extraction, the following preparation is necessary:

- Create a project in Software AG Designer.
- In our example, the source of the COBOL server EMPLOYEE is a member of file QCBLLESRC in library EMPLAPPL of AS/400 (Fig. 1). Therefore, you download (e.g., with FTP) the COBOL Source from AS/400 into the Software AG Designer project.
- For extraction, define a COBOL Environment for IBM i (AS/400 Operating System): see Preferences Software AG \> EntireX \> COBOL \> IDL Extractor for COBOL; Press button Insert and select IBM i as Operating System.
- Make sure you are in the EntireX perspective of the Software AG designer.

## Extract the interface of the COBOL server subprogram&nbsp;&nbsp;1&nbsp;

COBOL extraction is done as usual with EntireX. There are no AS/400 specifics to consider.

 ![](https://global.discourse-cdn.com/techcommunity/original/2X/7/7df60a7707e17bd67e167e5b9b9e5defe2ef1e85.jpeg)  
_ **Fig 2:** Extract AS/400 COBOL server EMPLOYEE_

The full set of features for EntireX COBOL extractions is available, as it is for other COBOL environments (e.g., z/OS ®, z/VSE®, BS2000).

## Fast path extraction

Use the fast path extraction if you require quick results, as described in article: “How to call COBOL from webMethods Integration Server” (see (2) under Related Articles). Fast path extraction automatically includes **Map OCCURS DEPENDING ON;** i.e., the COBOL term for a variable-sized table or IDL unbounded array, often abbreviated as ODO.

## Interface shaping

Use interface shaping to produce small and modernized IS services, rather than one big IS service. Without changing the COBOL server itself, interface shaping allows you to:

- **Map to multiple IDL interfaces:** Your COBOL server has multiple functions implemented which are controlled by an operation or function code parameter. With this feature you map every COBOL function to a separate, small and handy IS service. You can specify meaningful long IS service names instead of being restricted to the 10-character limitation on AS/400. Refer to the former TECHniques article: “How to shape a call to COBOL from webMethods Integration Server – the modern way” (see (1) under Related Articles) for more information.
- **Map to in, out,**  **inout**** :** Defines the input/output signature of the IS service.
- **Select REDEFINE paths:** Either the parameter which is redefined or one of its redefinitions is available as an IS field.
- **Suppress unneeded COBOL data items:** The COBOL parameter does not exist in the IS service as an IS field.
- **Set COBOL data items to constants:** The COBOL parameter does not exist in the IS service as an IS field. The constant value is provided internally by EntireX runtime.

Usage of _Suppress_ and _Set Constant_ keeps focus on relevant data items and keeps the client’s interface clean. It may also improve performance.

Refer to EntireX documentation for more information:  
Software AG IDL Extractor for COBOL \> COBOL Mapping Editor \> IDL Extraction per Interface Type \> (Interface Type) Standard Linkage \> Mapping Editor IDL Interface Mapping Functions.

## Generate IS service and IS connections&nbsp;&nbsp;2&nbsp;

You generate the Connection and Integration Server services in the usual way: Use the context menu of the Software AG IDL and invoke _Integration Server \> Generate webMethods IS Connection..._

 ![](https://global.discourse-cdn.com/techcommunity/original/2X/6/6ec30239526f87b44f2b51979527e7d2039c730b.jpeg)  
_ **Fig 3:** Generate IS Service and Connection_

Of course, you have to select type AS/400 Connection (see Fig.3), then specify target package, folder, connection name and hostname.

## Test IS service to COBOL server on AS/400&nbsp;&nbsp;3&nbsp;

For testing, use the service development perspective, as you do for every other IS service test. On the context menu of the generated IS service, select Run As \> Run Service...

 ![](https://global.discourse-cdn.com/techcommunity/original/2X/4/44df71d7bf5fc747a1f72dce5fb9240acf408bf5.jpeg)  
_ **Fig 4:** Call the AS/400 COBOL Server from IS_

## REST enablement

With EntireX 10.3 (GA: 2018Oct) the IS service generation wizard will allow for generating REST resources on the IS at the same time. This will open all back-end services for further API management.

## RPC Server for AS/400

For accessing AS/400 server from environments other than webMethods IS, use the RPC Server for AS/400. A typical architecture consists of RPC client, the EntireX Broker and RPC server for AS/400. The RPC Server for AS/400 acts on one side as an RPC server and on the other side as a client for calling AS/400 server programs.

![](https://global.discourse-cdn.com/techcommunity/original/2X/8/867d78143c534fcb0fceabc0d840d4d9c14d1420.jpeg)  
_ **Fig 5:** Architecture diagram for accessing AS/400 server from environments other than webMethods IS_

## Summary

As demonstrated, it is quite easy to develop a scenario where IS calls COBOL on AS/400. You can rely on EntireX to do all of the work for you from the design phase through runtime. COBOL- specific data types are mapped automatically to suitable IS data types.

To learn more, read [Common Integration Scenarios](https://documentation.softwareag.com/webmethods/wmsuites/wmsuite9-9/EntireX/9-9_EntireX/scenarios/overview.htm) from webMethods EntireX documentation.

## Related articles

“[How to shape a call to COBOL from webMethods Integration Server – the modern way](http://techcommunity.softwareag.com/techniques-blog/-/blogs/how-to-shape-a-call-to-cobol-from-webmethods-integration-server-the-modern-way)" TECHniques, January 2018 (Issue 1)  
“[How to call COBOL from webMethods Integration Server](https://techcommunity.softwareag.com/t/webmethods-entirex/237733),"  
TECHniques, April 2017 (Issue 2)  
“[How to call webMethods Integration Server from COBOL – mainframe outbound,](http://techcommunity.softwareag.com/techniques-blog/-/blogs/how-to-call-webmethods-integration-server-from-cobol-mainframe-outbound)" TECHniques, April 2016 (Issue 4)

| 
## Glossary of terms

**AS/400®** &nbsp;– midrange hardware; also known as iSeries, iSeries i5; System i

**IDL&nbsp;** – Interface Description Language

**Interface Shaping** &nbsp;– advanced extractions to shape a call to COBOL; also called User-defined mapping resulting in IDL and CVM (client-side server mapping) file

**IS** &nbsp;– webMethods Integration Server

**OCCURS DEPENDING ON table** &nbsp;– COBOL array of variable length

**OS/400®** &nbsp;– midrange operating system; also known as i5/OS, IBM i

**REDEFINE** &nbsp;– same memory area described by different data items

**REST&nbsp;** – REpresentational State Transfer: A paradigm that allows to describe structure and behavior of the World Wide Web

 |
