Comment lines: Reginaldo Barosa: Get COBOL without coding by transforming UML

You might be happy enough to learn that you can transform a Unified Modeling Language (UML) model into COBOL -- but have you thought about how much more of your application you can "code" by transforming UML to COBOL? This content is part of the IBM WebSphere Developer Technical Journal.

Reginaldo Barosa (rbarosa@us.ibm.com), Senior Certified IT Specialist, EMC

Author photoReginaldo W. Barosa is an IBM Certified Application Development Specialist. He provides sales support, helping customers with enterprise transformation solutions and development tools, such as WebSphere Developer for System z. Before joining IBM US, Reginaldo worked for 27 years in IBM Brazil. He has co-authored IBM Redbooks and has written books, as well as other articles for IBM developerWorks. He holds a degree in Electrical Engineering from Instituto Mau de Tecnologia, Sao Paulo, Brazil.


developerWorks Professional author
        level

22 August 2007

Can I transform UML into COBOL?

Can I create a model using Unified Modeling Language (UML) and transform it into COBOL language to be deployed into z/OS®?

I have heard this question many times during presentations of IBM® development tools around the world. A very simple answer is: Yes, today you can transform UML into COBOL code. But the point is, how much of your application can you now develop doing UML transformation to COBOL? To illustrate the ease and benefit of this development proposition, I will show you an example here of UML to COBOL transformation using IBM tools.


Model Driven Development and WebSphere Developer for System z

Model Driven Development (MDD), together with its associated UML-based tools, has been around for more than a decade now. Several advanced organizations have successfully used MDD to substantially increase their competitive edge and market share through improved productivity, quality, and time-to-market.

Studies reveal that using MDD practices can improve productivity by a factor of two to four, compared to traditional document-driven and code-centric development (see Resources).

IBM WebSphere® Developer for System z V7 has wizards to automatically generate CICS® COBOL code that accesses a DB2® database from a given UML model. These wizards transform UML into COBOL and WSDL (Web Services Definition Language), as well as generate the JCL that will help you implement the code generated. The wizard assumes that the UML model is complete. IBM Rational® Software Architect can be used to define the UML model. See this architecture in Figure 1.

The generated COBOL consists of two main programs per DB2 table, along with auxiliary COBOL programs to perform the XML parsing, and so on. The first main COBOL program performs the standard CRUD (Create, Read, Update, Delete), operations set, acting on a single record. The second main program handles the search/list operation for multiple DB2 rows.

Similar transformations could be done by WebSphere Developer for System z from existing DB2 schema, but I am focusing in the UML transformation in this article.

Figure 1. Database application generator architecture
Figure 1. Database application generator architecture

Working with the UML model

When working with UML, the current version of WebSphere Developer for System z (Version 7.0) transformation assumes:

  • Any class in the UML model is treated as a DB2 table.
  • Any property of a class is treated as a column of this table.
  • Other UML items, including operations and methods in the class, are ignored in the transformation.

As you see, with the current implementation, there is no way to transform the UML model into COBOL business logic; it is a very database-oriented kind of transformation. Any operation in the UML class model is ignored.

WebSphere Developer for System z can be installed on top of Rational Software Architect; in this case, you would not need to import and export the UML. However, it is not typical for developers to have Rational Software Architect in their desktop.

The main steps you must perform to create and deploy the assets using the wizard are:

  1. Export the UML model from Rational Software Architect.
  2. Import the UML model to WebSphere Developer for System z.
  3. Use the Database Application Generator wizard to edit and configure the transformation parameters.
  4. Run the transformation.
  5. Create the z/OS DB2 tables that map the UML classes.
  6. Deploy the code generated to z/OS CICS.
  7. Configure and install the CICS Web services on z/OS.
  8. Test the Web services created.

Figure 2 shows a UML model that I used in one transformation example.

Figure 2. UML model created by Rational Software Architect
Figure 2. UML model created by Rational Software Architect

Edit and configure the transformation parameters

After importing the UML model to WebSphere Developer for System z, you must configure the transformations using the wizards. In this example, the UML model does not possess all the necessary implementation characteristics. For example, when configuring the customer number (CUST_NO) transformation, I defined this attribute as Integer (Figure 3).

Figure 3. Using the Transformation Parameters Editor
Figure 3. Using the Transformation Parameters Editor

You must also configure other details for the transformation, such as CICS, MVS, and USS.

Basically, "MVS" and "USS" are the z/OS dataset names that will be used in the JCL generated code, and USS is used by CICS Services, such as for the location where the WSBIND code will be stored in the z/OS. Figure 4 shows the configuration specified for the CICS resources that will be generated by the transformation.

Figure 4. Configuring the CICS resources
Figure 4. Configuring the CICS resources

Running the transformation

In this example, the transformation generated all the assets showed in Figure 5. Note that during the transformation, if Automatic Remote Deployment is selected, and you are connected to the z/OS system, the following actions are performed:

  • All .cbl files are moved to the specified target COBOL data set on the MVS system.
  • All .jcl files are moved to the specified target JCL data set on the MVS system.
  • The JCL is submitted to the host.
  • All .wsbind files are moved to the specified WSBIND directory on the USS system
  • All .wsdl files are moved to the specified WSDL directory on the USS system.
Figure 5. Assets generated by the transformation
Figure 5. Assets generated by the transformation

Description of the generated assets

The transformation will generate COBOL assets (with type cbl), the WSBIND files necessary to deploy CICS Services (with type wsbind), the WSDL files (with type wsdl), the JCL (with type JCL), and log files (with type log). Here are brief descriptions of the generated assets:

  • @USTCRUD.cbl: Many COBOL programs responsible for performing the Web Services Converter Driver of the CRUD COBOL application.
  • @USTLIST.cbl: Many COBOL programs responsible for the Web Services Converter Driver to be used by the LIST COBOL application.
  • CUSTCRUD.cbl: COBOL program that performs the CRUD operations against the z/OS DB2 table.
  • CUSTCRUD.log: Log file for the CRUD application. It logs the date, the version of WebSphere Integrator for System z used, parameters used for the transformation, and so on. This file must be provided to IBM if support is needed. This file also has the hexadecimal content of the WSBIND file generated.
  • CUSTCRUD.wsbind: The WSBIND file required by CICS to create the Web service for the CRUD application. This file will need to be installed in the z/OS system in the CICS Web service pickup directory.
  • CUSTCRUD.wsdl: This is the Web Service Definition Language (WSDL) file that is needed later for invoking the CRUD Web service that was created. This file does not need to be moved to the z/OS system, since the XML parsing is done by the COBOL driver generated and not by CICS.
  • CUSTLIST.cbl: COBOL program that performs a read on multiple rows from the table.
  • CUSTLIST.log: Log file for the LIST application, similar to the content as described above for the CRUD application.
  • CUSTLIST.wsbind: The WSBIND file required by CICS to create the Web service for the LIST application.
  • CUSTLIST.wsdl: The WSDL that defines the LIST Web service application. It will be used later for invoking the LIST application via CICS services.

Here are brief descriptions of the generated JCL:

  • ITSOBD.JCL: JCL to build the generated CRUD and LIST COBOL application programs and bind the DB2 plans and packages. This JCL will invoke the proc ITSOCB, which is also generated.
  • ITSOBDDR.JCL: JCL to build the CRUD and LIST COBOL generated driver programs. This JCL will invoke the proc ITSOCBDR, which is also generated.
  • ITSOCB.JCL: Procedure used by ITSOBD.JCL to:
    • DB2 pre-compile or pre-process of COBOL programs with EXEC SQL statements.
    • CICS pre-compile of COBOL programs with CICS statements.
    • COBOL compile.
    • Linkedit compiled programs.
  • ITSOCBDR.JCL: Procedure used by ITSOBDDR.JCL to perform the COBOL/CICS operations to the generated driver program.
  • ITSORDO.JCL: JCL to define CICS resources via Resource Definition Option (RDO).

Using the Web Services Test Explorer to invoke the LIST application

After the generated code is deployed, I used the Web Services Test Explorer component of WebSphere Developer for System z to test Web services to get instant feedback. In my example, I want to list 8 rows (Figure 6).

Figure 6. Testing the CICS Web service deployed
Figure 6. Testing the CICS Web service deployed

As you can seen, this UML to COBOL transformation does not provide all the necessary code generation from UML as you might ideally need, but it is certainly a good start, and you might save some time by generating the code that you can.

Also, notice that the wizard generates 100% COBOL without any proprietary code, subroutines, or any other framework. Even if you are not interested in deploying CICS Web services, you still can take advantage of having COBOL code that uses a DB2 table that was mapped from the UML class.

Future versions of this feature will be improved, possibly to enable you to create your own templates. IBM is always eager for feedback, so let us know your ideas or suggestions on the current implementation.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=245973
ArticleTitle=Comment lines: Reginaldo Barosa: Get COBOL without coding by transforming UML
publish-date=08222007