This chapter provides information about how you can extend your legacy CICS applications with MTO.
Legacy extension is the process of exposing your CICS applications to a range of non-CICS client types. MTO provides the following legacy extension facilities:
A COBOL program running as a service in an enterprise server can call a CICS program running in the same enterprise server. The service can be either a Web service or a service called from an EJB. The service must be configured to be container-managed.
To use this facility you need to:
The COBOL program calls the CICS program using the External CICS Interface (EXCI). To use this interface, you need to code an EXEC CICS LINK call every time the COBOL program wants to invoke a CICS program. This is similar to the EXEC CICS LINK call used in a CICS program to perform distributed program linking. However, there are some significant differences.
The format of the call is as follows:
EXEC CICS LINK PROGRAM(program-name) RETCODE(data-area-1) COMMAREA(data-area-2) . . . END-EXEC
where the options are as follows:
PROGRAM(program-name) | The name of the CICS program to be invoked |
RETCODE(data-area-1) | An area in which the CICS program places a return code indicating sucess or failure |
COMMAREA(data-area-2) | An area that the service program and the CICS program use for communications |
There are other options; for a full list see the IBM publication CICS External CICS Interface Guide.
The call must be immediately followed by an EXEC-END statement.
For example:
exec cics link program (ws-program) commarea (ws-commarea) retcode (exci-exec-return-code) end-exec
We supply a copy book, DFHXCPLO, which provides data descriptions for RETCODE and COMMAREA. You can find this copy book in $COBDIR/cpylib. The copybook has data descriptions for the parameter passed in the RETCODE field, exci-exec-return-code:
01 exci-exec-return-code. 03 exec-resp pic 9(8) comp. 03 exec-resp2 pic s9(8) comp. 03 exec-abcode pic x(4). 03 exec-msg-len pic 9(8) comp. 03 exec-msg-ptr pointer.
You need to compile the program in Net Express or Server Express with the CICSECM(EXCI=YES) directive. Note that if you are using the Net Express GUI, you must not check EXEC CICS on the Compile tab of the Build Settings dialog box, but must type the directive in Directives.
After you have performed any interface mapping necessary to make the program available a a service, you need to deploy it. For more information on interface mapping and deploying see Part 1 and Part 2 of your COBOL development system Distributed Computing book. The program must be deployed as a container-managed service.
Once the COBOL program has been deployed to the MTO-enabled enterprise server where the target CICS program runs, you need to invoke it using a suitable client. For more information about clients see the chapters COBOL Web Services with the Interface Mapping Toolkit and Mapping a Java Interface and Using Resource Adapters in your COBOL development system Distributed Computing book.
When the EXEC CICS LINK statement in the service program is executed, control is passed to the CICS program, which executes and passes the results back to the calling service program. The service program sets the return code to indicate to the container wheher or not the transaction should be rolled back.
When a service executes within an enterprise server, the COBOL program search path is restricted to the setting of Package Path within the service’s package object, set on the Edit Package page of Enterprise Server Adminstration. When an EXCI call is issued the search path is temporarily modified to include the system-wide CICS Transaction Path set on the Edit Server > Properties > MTO page.
The following restrictions apply to the use of the External CICS Interface:
The following components are required to run a CICS application using CTG and Enterprise Server with MTO:
Net Express and Enterprise Server can be on the same or different machines.
This chapter uses CTG to mean IBM CICS Transaction Gateway or IBM Universal Client.
You use CTG as the middleware between your client program and the CICS application running on Enterprise Server.
To enable support for CTG, you need to set up both the client and server software. You need to:
This chapter uses the application eci.app to demonstrate how to set up the client and server software.
To follow the examples in this chapter, you need Net Express 4.0 Professional with MTO installed, so that you can compile and run the demonstration client program. You need the following software installed:
If you want to deploy to UNIX, you need, in addition, Server Express 4.0 Service Pack 1 with MTO with the following parts installed:
The CTG demonstration programs are supplied with Net Express in the base\demo\mto-ctg directory of your Net Express installation. They are:
eci.app | A Net Express project file for the COBOL programs. |
eci2oper.cbl | A server program that you run under Enterprise Server. It consists of a CICS program that writes a data area to the system console. This transaction program performs a WRITE OPERATOR command on the field ECI-DEMO-MESSAGE using the text passed in the DFHCOMMAREA. If the WRITE OPERATOR command fails, the EIBRESP and EIBRESP2 values are passed back to the calling program in the fields ECI-ERROR-EIBRESP and ECI-ERROR-EIBRESP2. |
eci-call.cbl | A client program that you run under Net
Express. This batch program has three main parts:
|
eci2oper.mlc | The data conversion macros needed by the demonstration application. |
The CTG needs to know which machine the server program is running on.
You specify this using the CTG configuration tool. Alternatively, you can edit the CTG configuration file ctg.ini (or cicscli.ini for Universal Client) on the client machine.
To configure the CTG client for the demonstration:
Server name | name for the enterprise server, such as myCICSserver |
Network protocol | TCP/IP |
Hostname or IP address | name of the machine running enterprise server |
Port | port number to listen on, which must be the same as the port number you specify for the Enterprise Server listener, later. The port number defaults to 1435, which is the IANA recognized port number for IBM CICS. |
Only the server name and hostname or IP address is mandatory.
You need to insert your ECI calls to the CTG in your program. In COBOL, an ECI call looks like this:
CALL "CICS_ExternalCall" USING ECI-PARMS
ECI-PARMS is the ECI parameter block, through which the program communicates with the server. The parameter control block is available as a copybook in the copybook folder within your CTG installation. It is called cicseci.cbl. You need to make this copybook available to your client program. You do this by adding the CTG copybook directory to the COBCPY environment variable.
When you compile your program to an executable, you must link it to the CTG library, cclwin32.lib.
For further information about using CICS Transaction Gateway, see the IBM manual CICS Family: Client/Server Programming (SC33-1435).
Before you run the demonstration, prepare the Net Express client as follows:
01 ECI-Client-Type. 03 pic x comp-x *> -- *> --Change the following value to select client type *> -- value 0. 88 ECI-MicroFocus-88 value 0.88 88 ECI-UniCli-88 value 1.
Change the above value clause to set ECI-Client-Type to 1.
When you compile CICS programs, you use the CICS External Compiler Module (ECM), which preprocesses the EXEC CICS statements. The ECM is invoked by the CICSECM() directive, which you set when you choose EXEC CICS in the project build settings. The client program passes the Program-ID of the server program to Enterprise Server, which locates the program and starts it.
To compile the demonstration CICS program:
To configure the enterprise server for the demonstration:
install-dir\base\demo\mto-ctg\debug
To enable support for CTG, you need to add an MTO listener to Enterprise Server so that it can receive and handle client requests from CTG. When you add the listener, you configure it and you specify a port for the listener to listen on.
To add a listener for the demo application:
Then click Add to return to the listeners page.
To run the demonstration:
Within a single system using MTO, file data is always presented in the same codeset in which it was recorded. Between two systems running MTO, or between MTO and other CICS systems, data may need to be translated between EBCDIC and ANSI. The requirement and the method you use to meet it depend on which middleware you are using.
If you use IBM CICS Transaction Gateway, you can supply information that enables data to be converted in data conversion templates, which are held in an indexed file called dfhdrcnv, in the same folder as the resource definition file (by default ). Each data conversion template contains entries for resources that need translation and identifies which data fields require it. Each resource must have an entry in the resource definition file.
You cannot edit the file dfhdrcnv directly; instead you maintain it by importing mainframe-style DFHCNV macros, and by deleting templates that you no longer need.
Mainframe-style DFHCNV macros are organized into entries and templates. An entry is a set of conversion macros that apply to the same resource; the start of an entry is marked by a DFHCNV macro that begins TYPE=ENTRY and the entry continues until the next macro that begins TYPE=ENTRY, or until the END marker. An entry can contain one or several templates, depending on the type of resource it belongs to. For more information about mainframe-style DFHCNV macros, see the following IBM manuals:
You use the command cascnvim to convert the data. For more information see the help topics cascnvim and Data Conversion.
Note: If data conversion is required for a program's COMMAREA, you must define a PPT entry for that program; see the section Controlling CICS Resources in the chapter Administering MTO-enabled Enterprise Servers.
The following data conversion macros apply to a file (TESTFC), which has two data constructs, and to a program (TESTPC):
TITLE 'DFHCNV MACRO IMPORT' * --------- START OF DFHCNV MACROS ---------- * DFHCNV TYPE=INITIAL,CLINTCP=(932, 437,XXXX) SPACE 2 DFHCNV TYPE=ENTRY,RTYPE=FC,RNAME=TESTFC,USREXIT=NO DFHCNV TYPE=KEY DFHCNV TYPE=FIELD,OFFSET=0,DATATYP=CHARACTER,DATALEN=8 DFHCNV TYPE=FIELD,OFFSET=8,DATATYP=PD,DATALEN=3,LAST=YES DFHCNV TYPE=SELECT,OPTION=COMPARE,OFFSET=11,DATA='A' DFHCNV TYPE=FIELD,OFFSET=0,DATATYP=CHARACTER,DATALEN=8 DFHCNV TYPE=FIELD,OFFSET=8,DATATYP=PD,DATALEN=3 DFHCNV TYPE=FIELD,OFFSET=11,DATATYP=CHARACTER,DATALEN=1 DFHCNV TYPE=FIELD,OFFSET=12,DATATYP=PD,DATALEN=4 DFHCNV TYPE=FIELD,OFFSET=16,DATATYP=PD,DATALEN=4 DFHCNV TYPE=FIELD,OFFSET=20,DATATYP=BINARY,DATALEN=8 DFHCNV TYPE=FIELD,OFFSET=28,DATATYP=USERDATA,DATALEN=10, X23456789 USRTYPE=B'01010000' DFHCNV TYPE=FIELD,OFFSET=38,DATATYP=CHARACTER,DATALEN=50, X LAST=YES DFHCNV TYPE=SELECT,OPTION=COMPARE,OFFSET=11,DATA='B' DFHCNV TYPE=FIELD,OFFSET=0,DATATYP=CHARACTER,DATALEN=8 DFHCNV TYPE=FIELD,OFFSET=8,DATATYP=PD,DATALEN=3 DFHCNV TYPE=FIELD,OFFSET=11,DATATYP=CHARACTER,DATALEN=1 DFHCNV TYPE=FIELD,OFFSET=12,DATATYP=USERDATA,DATALEN=2 DFHCNV TYPE=FIELD,OFFSET=14,DATATYP=CHARACTER,DATALEN=20, X LAST=YES DFHCNV TYPE=ENTRY,RTYPE=PC,RNAME=TESTPC DFHCNV TYPE=SELECT,OPTION=DEFAULT DFHCNV TYPE=FIELD,OFFSET=0,DATATYP=BINARY,DATALEN=12 DFHCNV TYPE=FIELD,OFFSET=12,DATATYP=CHARACTER,DATALEN=96 DFHCNV TYPE=FINAL END
Copyright © 2005 Micro Focus International Limited. All rights reserved.