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:
- Launch IBM Rational Developer for Power Systems Software on your workstation.
- 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
- 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."
- 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
- 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.
- For Remote Location, enter the path of the AIX server where the CICS COBOL programs are located, in this form:
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
- 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.
- Right-click the AIX COBOL project in the Project Explorer pane, and select Properties.
- Select COBOL > Default Copybook location.
- 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
- Right-click the HelloCOBOL project in the Project Explorer, and select New > AIX COBOL File.
- In the COBOL file window, select Type as COBOL source.
- In the File Name field, enter the COBOL file name (
HELLOPRG), and select cbl from the drop-down menu.
- 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
- Click Finish.
- 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. |
- You need to create a Makefile file to build the HelloCOBOL project: Right-click the HelloCOBOL project, and select New > File.
- In the New File window (Figure 6), enter
Makefileas the File Name and click Finish.
Figure 6. Steps to create the Makefile file
You will now have an empty file called Makefile opened in the editor.
Sample Makefile code is provided in Listing 2.
- 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
- Save the file by selecting File > Save.
- 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
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.
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.
Learn
- Browse the TXSeries 7.1 information center and review the TXSeries product information.
- Review the Rational Developer for Power Systems Software overview page.
- Browse Rational Developer for Power Systems software information center for documentation, where you will find these instructions:
- Find out more about the Rational solution for Collaborative Lifecycle Management, a ready-to-run integrated ALM solution comprising Rational Team Concert, IBM Rational Quality Manager, and IBM Rational Requirements Composer.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Attend a free developerWorks Live! briefing to get up-to-speed quickly on IBM products and tools, as well as IT industry trends.
- Watch developerWorks on-demand demos, ranging from product installation and setup demos for beginners to advanced functionality for experienced developers.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, any time, and many of the "Getting Started" ones are free.
Get products and technologies
- Download and evaluate a free trial version IBM TXSeries for Multiplatforms.
- Explore the Enterprise Modernization Sandbox for Power Systems.
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
Discuss
- Participate in the TXSeries forum, join the CICS User Group to get updates on TXSeries, and follow IBM TXSeries on Twitter (@txseries) to get the latest updates, and
- Follow Rational software on Facebook and Twitter (@ibmrational) to and add your comments and requests.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Get social about thought leadership. Join the Rational community to share your Rational software expertise and get connected with your peers.
- Rate or review Rational software. It's quick and easy. Really.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. You'll get worldwide exposure, RSS syndication, a byline and a bio, and the benefit of professional editing and production on the developerWorks Rational website. Find out what makes a good developerWorks article and how to proceed.

Balaji 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 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 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 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.




