Develop TXSeries CICS apps with Rational Developer for Power Systems Software: Part 2. Create and build CICS applications for the TXSeries processor

In Part 2 of this three-part tutorial, you use the IBM® Rational® Developer for Power Systems Software™ configurations from Part 1 to create a new AIX COBOL project and an AIX COBOL program file. Code for a sample CICS application and a sample Makefile file is included.

Share:

Balaji S. Kumar (balajiku@in.ibm.com), Software Engineer, IBM

author photoBalaji S. Kumar has worked with both IBM TXSeries for Multiplatforms and IBM WebSphere eXtended Transaction Runtime and has made significant contributions towards Functional Verification Test for WXTR. He has won the best implementation award in HackDay, an IBM internal technical forum. He has also actively participated in other IBM forums.



Hariharan N. Venkitachalam (vharihar@in.ibm.com), Senior Software Engineer, IBM

author photoHariharan N. Venkitachalam holds a Diploma in Computer Science & Engineering from M.E.I Polytechnic, Bangalore, India. He is employed with IBM India Software Development Laboratory in India and has over ten years of experience in IT. His areas of expertise include distributed CICS systems and Structured Query Language (SQL) internals. He has co-authored a Redbook on "Revealed! The Next Generation of Distributed CICS". In his current role he leads the development team for WebSphere eXtended Transaction Runtime product and assists in technical pre-sales, and customer engagement services for the distributed CICS products. He has been working for the CICS organization since he joined IBM in 2001.



Janaki Sundar (janakisundar@in.ibm.com), Staff Software Engineer, IBM  

Janaki SundarJanaki Sundar has a B.Tech degree from the National Institute of Technology, Tiruchirappalli, India. She has been with the TXSeries for Multiplatforms and WebSphere eXtended Transaction Runtime teams at the IBM India Software Lab for five years. Her interests include CICS application development and modernization of testing using Rational tools. She has written for IBM developerWorks previously.



Nageswararao V. Gokavarapu (nagesh.gokavarapu@in.ibm.com), Staff Software Engineer, IBM  

author photoNageswararao V. Gokavarapu holds an M.E. in Electronic Instrumentation from Andhra University, India, and has been with IBM for the last five years. He has worked on distributed CICS transaction processors, including the WebSphere eXtended Transaction Runtime and TXSeries for Multiplatforms software. Nageswararao has written several IBM developerWorks articles, some of which were selected as featured articles. His areas of interest are virtualization, transaction processing management, and UNIX systems.



18 October 2011

About this series

Part 1 of this series introduced IBM® TXSeries® for Multiplatforms and IBM® Rational® Developer for Power Systems Software™, followed by instructions on installation and configuration of these products. Configuration of TXSeries included creating a region for deploying IBM® CICS® applications. Configuration of Rational Developer for Power Systems Software included installation of the Remote System Explorer component on an IBM® AIX® server and establishing a connection from Rational Developer for Power Systems Software to that server.

In Part 2, you use the configurations described in Part 1 to create CICS applications for TXSeries, using Rational Developer for Power Systems Software. Detailed steps have been provided to create a new AIX COBOL project and an AIX COBOL program file. A sample CICS application is also provided for reference in Listing 1. For building the AIX COBOL project, you can create a Makefile file using the code provided in Listing 2 in this article.


Create CICS applications using Rational Developer for Power Systems Software

This section helps you create a CICS COBOL application for TXSeries by using Rational Developer for Power Systems Software. The steps to use Rational Developer for Power Systems Software for creating an AIX COBOL project, and subsequently a CICS COBOL application for TXSeries, are explained in detail and illustrated with screen captures. Sample CICS COBOL application and a sample Makefile are provided for your reference. Although this article focuses on CICS COBOL applications, TXSeries CICS applications can also be written in C/C++. Essential guidelines have been provided in this article on developing C/C++ applications, wherever relevant (see "For C or C++:" notes).

Create a CICS COBOL application for TXSeries

Follow these steps to create a new CICS COBOL application using Rational Developer for Power Systems Software:

  1. Launch IBM Rational Developer for Power Systems Software on your workstation.
  2. Open the AIX COBOL perspective by selecting Window > Open Perspective > Other and choosing AIX COBOL from the menu.

Figure 1 shows the Open Perspective window.

Figure 1. Open Perspective menu options
AIX COBOL selected
  1. Use the TCP/IP connection to the AIX server, which was explained in Part 1, in the section titled "Configuring Rational Developer for Power Systems Software."
  2. To create a new AIX COBOL project, select File > New > AIX COBOL Project (see Figure 2).
Figure 2. Selections to create a new AIX COBOL project
File > New > AIX COBOL Project selected
  1. In the AIX COBOL Project window, enter the Project Name (for example, HelloCOBOL) and the Remote Location:
    • For Remote Location, enter the path of the AIX server where the CICS COBOL programs are located, in this form:
       (AIX connection name) path

      where AIX connection name is the connection mentioned in step 3, and path is the directory path where your CICS COBOL programs are located on AIX server.
    • Alternatively, you can select Browse and, in the Browse For Folder window, select your AIX connection and select the directory path where your CICS COBOL programs are located.

Note:
You also have the option to select the Associate a local location check box.

Figure 3 shows the Browse for Folder window, where you can choose the location for your COBOL project on the AIX server.

Figure 3. Steps to select the location for COBOL project on AIX server
Selecting location on AIX server for COBOL project
  1. Click Finish.

You can then find your project in Project Explorer pane.

For C or C++:
For working with CICS applications written in C/C++, create a remote C/C++ project in Rational Developer for Power Systems Software. Also, add the .ccs and .cpp extensions to the list of file types supported.

  1. Right-click the AIX COBOL project in the Project Explorer pane, and select Properties.
  2. Select COBOL > Default Copybook location.
  3. In the right pane, make sure that the /usr/lpp/cics/include path is added as the first item in the list. You can use the Add and Up buttons to do this. This step is required if you use EIB-related fields in your CICS application.

Figure 4 shows the Properties window with the copybook path added.

Figure 4. Copybook path required for TXSeries CICS applications
HelloCOBOL project Properties window
  1. Right-click the HelloCOBOL project in the Project Explorer, and select New > AIX COBOL File.
    1. In the COBOL file window, select Type as COBOL source.
    2. In the File Name field, enter the COBOL file name (HELLOPRG), and select cbl from the drop-down menu.
  2. Select the Initialize the file content from a template check box, and then select CICS Program source template from the Templates pane.

Figure 5 illustrates these steps to create a new AIX COBOL file.

Figure 5. Steps to create a new AIX COBOL file
Creating new AIX COBOL file
  1. Click Finish.
  2. Enter your business logic in the appropriate section in the HELLOPRG.cbl file.

Rational Developer for Power Systems Software provides all of the modern integrated development environment (IDE) features, such as syntax highlighting and CICS command assist (auto-complete). You can use these features to develop your CICS/COBOL application.

A sample CICS COBOL application is provided in Listing 1 for your reference. It has two COBOL programs:

  • HELLOPRG.cbl
  • LINKPRG.cbl

The following sample CICS COBOL application HELLOPRG.cbl receives data through COMMAREA. It does an EXEC CICS LINK to another program LINKPRG.cbl. After LINK is successful, HELLOPRG.cbl sends back the modified COMMAREA back to the client application. This can be extended to any complex business logic based on the requirements of the application.

Listing 1. Sample CICS COBOL application code
HELLOPRG.cbl
    IDENTIFICATION DIVISION. 
    PROGRAM-ID. HELLOPRG. 
    ENVIRONMENT DIVISION. 
    DATA DIVISION. 
    
    WORKING-STORAGE SECTION. 
    01 TEXT-OUT PIC X(16) VALUE 'HELLOPRG PROGRAM'. 
    01 RESP-CODE PIC S9(8) BINARY. 
    
    LINKAGE SECTION. 
    01 DFHCOMMAREA. 
        03 OCCURS 0 TO 32767 TIMES DEPENDING ON EIBCALEN PIC X(1). 
    
    PROCEDURE DIVISION. 
    
        DISPLAY TEXT-OUT ": YOU HAVE SENT COMMAREA: " DFHCOMMAREA
        EXEC CICS LINK PROGRAM('LINKPRG') 
            RESP(RESP-CODE) 
            COMMAREA(DFHCOMMAREA) 
            LENGTH(EIBCALEN) 

        END-EXEC. 
        
        IF RESP-CODE NOT = 0 THEN 
            MOVE "LINK failure" TO DFHCOMMAREA 
        ELSE 
            MOVE "LINK success" TO DFHCOMMAREA 
        END-IF. 
        
        EXEC CICS RETURN 
        END-EXEC. 

LINKPRG.cbl: 
    IDENTIFICATION DIVISION. 
    PROGRAM-ID. LINKPRG. 
    ENVIRONMENT DIVISION. 
    DATA DIVISION. 
    WORKING-STORAGE SECTION. 
    01 TEXT-OUT PIC X(15) VALUE 'LINKPRG PROGRAM'. 
    01 RESP-MSG PIC S9(8) BINARY. 
    
    LINKAGE SECTION. 
    01 DFHCOMMAREA. 
        03 OCCURS 0 TO 32767 TIMES DEPENDING ON EIBCALEN PIC X(1). 
    
    PROCEDURE DIVISION. 
        DISPLAY TEXT-OUT ":COMMAREA GOT THRU LINK: " DFHCOMMAREA 
        EXEC CICS RETURN 
        END-EXEC.

Create a Makefile file

  1. You need to create a Makefile file to build the HelloCOBOL project: Right-click the HelloCOBOL project, and select New > File.
  2. In the New File window (Figure 6), enter Makefile as the File Name and click Finish.
Figure 6. Steps to create the Makefile file
New File window with Makefile entered

You will now have an empty file called Makefile opened in the editor.

Sample Makefile code is provided in Listing 2.

  1. Modify the default value for the following variable in the sample Makefile code (you created this on the AIX server in Part 1, in the section titled "Creating and configuring the TXSeries region"):
    TX_REGION > TXSeries region_name
  2. Save the file by selecting File > Save.
  3. In the Project menu, ensure that the Build Automatically option is selected. This initiates the build automatically, as you save your COBOL programs. Figure 7 shows this option.
Figure 7. Build automatically option in the Project menu
Drop-down menu for the project

Tips:

  • If the Build Automatically option is not selected, you can right-click the HelloCOBOL project and select Build Project.
  • You can check the status of the build in the Console view.

The Makefile code in Listing 2 compiles the TXSeries application programs written in the COBOL language. It will compile the latest modified programs. If the program is compiled for the first time, it adds the Program Definition (PD) entry in the TXSeries region Stanza file. It also links the compiled executable file to the specified region's bin directory.

You can use this sample Makefile for compiling your COBOL programs.

Listing 2. Sample Makefile code
.SUFFIXES: 

.SUFFIXES: .cbl .ibmcob 

TARGET = `ls -1 *.cbl | sed "s/.cbl/.ibmcob/"`

# Setting all the flags required 
COB = cob2_r 

COB_OPTS = -g -qAPOST -qNOTHREAD -qLIB 

LINK_OPTS= -e _iwz_cobol_main 

CICS_OPTS= -qCICS -I$(CICSPATH)/include -I. -bI:$(CICSPATH)/lib/cicsprIBMCOB.exp 

# Setting TX_REGION variable to point to the TXSeries region 
TX_REGION=TXREG 

all: $(TARGET) 

.cbl.ibmcob: 

    @slibclean 
    
#   Compilation step 
    $(COB) $< -o $@ $(COB_OPTS) $(CICS_OPTS) $(LINK_OPTS) 
#   Providing a soft link of the executable to TXSeries region's bin directory 
    @ln -fs $(PWD)/$@ /var/cics_regions/$(TX_REGION)/bin/$@ 
#   Checking if PD entry already exists for the program and if not, adding an entry
    @progname=`basename $@ .ibmcob` && \
    
    EntryCheck=`cicsget -c pd -r $(TX_REGION) $$progname 2>&1|grep ERZ046005E|wc -l` && \ 
    
    if [ $$EntryCheck == 1 ] ; then \
    
    cicsadd -c pd -B -r $(TX_REGION) $$progname PathName=$$progname RSLKey=
    public 2>/dev/null ;\
    
    fi 


clean: 

    @rm -f $(OBJ) core *.lst *.adt cmpout.xml $(TARGET)

Important:
Make sure to provide the tab space for the rules specified in the Makefile after copying the contents to Rational Developer for Power Systems Software. Set the TX_REGION variable in the Makefile to the appropriate region name. The -qCICS option in CICS_OPTS flag in the above Makefile file in Listing 2 is the CICS coprocessor option. This option is provided by COBOL to compile applications with CICS statements.

If you are creating a CICS COBOL program with the .ccp extension, modify the TARGET and add the appropriate rule in the Makefile, as Listing 3 shows.

Listing 3. Target and rule modification for .ccp programs in the Makefile file
TARGET = `ls -1 *.ccp 2>/dev/null | sed "s/.ccp/.ibmcob/"` 
                
.ccp.ibmcob: 
    @slibclean 
    @progname=`basename $@ .ibmcob` &&\ 
    cicstcl -el IBMCOB $$progname &&\ 
    ln -fs $(PWD)/$@ /var/cics_regions/$(TX_REGION)/bin/$@ &&\ 
    EntryCheck=`cicsget -c pd -r $(TX_REGION) $$progname 2>&1|grep ERZ046005E|wc -l` &&\ 
    if [ $$EntryCheck == 1 ] ; then\ 
        cicsadd -c pd -B -r $(TX_REGION) $$progname PathName=$$progname RSLKey=
        public 2>/dev/null ;\ 
    fi

For C or C++:
If you are creating a CICS C program with the .ccs extension, modify the TARGET and add the appropriate rule in the Makefile, as Listing 4 shows.

Listing 4. Target and rule modification for .ccs programs in the Makefile file
TARGET = `ls -1 *.ccs | sed "s/.ccs//"` 

.ccs: 
    @slibclean 
    cicstcl -elC $@ 
    ln -fs $(PWD)/$@ /var/cics_regions/$(TX_REGION)/bin/$@ &&\ 
    EntryCheck=`cicsget -c pd -r $(TX_REGION) $@ 2>&1|grep ERZ046005E|wc -l` &&\ 
    if [ $$EntryCheck == 1 ] ; then\ 
        cicsadd -c pd -B -r $(TX_REGION) $@ PathName=$@ RSLKey=public 2>/dev/null ;\ 
    fi

If the application program uses FILE/TDQ operations, add the corresponding TXSeries resource definition using the cicsadd command, and restart the TXSeries region in Cold mode for the resources to be operational. Starting the TXSeries region is explained in the section titled "Test the sample application" in Part 3 of this series.


What's next

This article explained how to develop TXSeries CICS applications on AIX server using Rational Developer for Power Systems Software. It also described deploying the CICS application onto TXSeries for Multiplatforms. Part 3 of this series will show you how to create a client project in Rational Developer for Power Systems Software and test your application by using CICS Transaction Gateway.

Resources

Learn

Get products and technologies

Discuss

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 Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, DevOps
ArticleID=765597
ArticleTitle=Develop TXSeries CICS apps with Rational Developer for Power Systems Software: Part 2. Create and build CICS applications for the TXSeries processor
publish-date=10182011