Web Services: Key to Mainframe Modernization


It has been many years since closed networks displaying and updating data with 3270 terminals provided an acceptable solution: banks and other mainframe users must now provide access through web pages and mobile apps.  Your enterprise data must be available in the right way on the right platforms, and so mainframes must communicate with other computers that don’t use CICS or COBOL.  "Application Modernization" doesn't mean "replace the mainframe", it means that you require web services.

What is a Web Service?

A web page can display data, text, and graphics, and expect a human to interpret the page to understand what the data means, and what to do with it.   A web service is like a web page, but its purpose is to provide information to another program, not a human reader.

The client and server must be able communicate whatever technology the other uses. The mobile app that sends the request and receives the response is most likely written in Java.  It doesn’t know that the message is going to/from a mainframe, all it has is an IP address and a description of the message formats.  In the mobile (and PC and Unix) worlds, characters are encoded with ASCII, and decimal numbers are carried in binary.

The mainframe app, which may be a COBOL program accessing DB2 or VSAM to get necessary data, doesn’t know that the request comes from a Java program, it only knows that the response must be sent back to an IP address.  In this world characters may be encoded with EBCDIC, and account balances are usually packed numbers.

Both ends must agree to use a common message standard, probably REST using JSON as this standard is widely supported.   The request is received by a CICS program which translates the JSON message into a COBOL-format input message and passes this to the COBOL program.  The program then does whatever it needs to do and prepares a COBOL-format output message which is passed back to CICS. The reverse translation occurs and the message is sent back. The COBOL web service thinks that it is sending EBCDIC-encoded characters and packed numbers, the Java program thinks it’s receiving ASCII-encoded characters and binary numbers.

Writing CICS COBOL Web Services

Web service programs are similar to classical CICS programs without the restrictions of 3270 message formats, so writing a web service program takes a similar amount of effort.  However they are easy to develop with MANASYS Jazz which effortlessly handles the detail, leaving you to concentrate on the business problem.  For example, here we generate a web service program that can update records from Employee, a DB2 Table.  If we only want a subset of Employee fields, check Select instead of All Fields.


Click [Finish] and this becomes a brief Jazz program that provides Enquiry, Update, Add, and Delete functions.  Built-in data validation and update integrity checking, is standard.  Click [Process] and this is turned into COBOL.

The program starts by checking that the input message has a valid function code: “E” for “Enquiry”, etc.  The appropriate logic is then executed, or the program aborts with a message.

·         Enquiry.  Employee is defined with EMPLOYEE.EMPNO as primary key, and EMPLOYEE.WORKDEPT as an alternate (duplicate) key, so


finds zero, one, or several Employee records and the program responds with up to 10 of them.

·         Update: Record Integrity. Update must follow an Enquiry, and we need to ensure that other users have not changed the record since our Enquiry.  The classical way of preventing invalid updates without excessive locking was to save a copy of the original record in COMMAREA, and then re-read the record and check that it hasn’t changed before allowing the update.  We can’t do this with web service as we can’t pass a COMMAREA from step to step of a conversation.  Instead of a record copy we use a checksum which is included in messages. The Enquiry executes


which calculates Employee’s checksum and saves it in the output message.  This checksum is returned in the Update request, and checked by


The update will fail if the record has been changed.  

·         Update: Data Validation.  Update programs must not create invalid records.  Employee’s definition includes rules like: WORKDEPT must be an existing DEPARTMENT.DEPNO, SEX must be “M” or “F”, as well as rules implied by field formats.  GET UPDATE logic ends with: -



ACCEPT (IJSPG2.JZ-EMPLOYEE.*) checks that every Employee field in the input message (except EMPLOYEE.EMPNO) is valid.  WORKDEPT must be a value that can be found in the DEPARTMENT table, SEX can only be M or F, HIREDATE is a valid date, and so on. 

Click here to see the COBOL of program JSPG2.   2532 lines of COBOL that was written for you, and works first time!

Extending Generator Logic

Everything so far has required no programming other than using the New Web Service dialog.  We could also have generated a program that could handle enquiry or update with a parent/child record hierarchy, like customer and order records. 

Some real-life situations require more flexibility.  For example, you may be modernizing a classical CICS system, and you’re replacing a multi-step 3270 conversation with a single web page or Windows™ program returning several different record types.  The generator can’t create this web service, but you could generate an initial program that did part of the job – say get the customer record and orders – and then extend this to do what you want.   Both message formats and the Jazz program are fully editable, so that you can easily add logic to handle other data like purchase and product records.

For more information refer to the Users’ Guide pages about Web Services, including Web Services and Micro Focus if relevant.


If you want to create COBOL web services, then MANASYS Jazz is an invaluable tool, making it possible to create and deploy new web services in hours instead of weeks.  But what has it done for client-side programming?   Does it remain a difficult task to write the Java (or whatever) client programs that will interact with these services?  The next article in this series will look at these questions. 

This is the 5th of a 10-part series of articles about MANASYS Jazz. Click below to see previous articles
            1. What is MANASYS Jazz?
            2. How does MANASYS Work?

3. Convert Easytrieve to COBOL with MANASYS Jazz

4. Mainframe Modernization Issues

See our web page if you want more information about MANASYS Jazz and to see what else it can do.  Contact us if you have any questions, or connect with us on LinkedInDownload a free evaluation copy if you want to try out MANASYS Jazz.