88 CCF-to-J2C Architecture Migration
Figure 7-5 Interaction diagram for the components interacting with CCF classes
7.1.3 Implementation assessment
The important details of the application implementation are how the application
interacts with the CCF components and the CICS interface.
As can be seen from Figure 7-5, the interaction with the CICS consists of the
following steps:
buildrequest
performrequest
–buildECI
– flowECI
buildResponse
In the following text, each step is described in detail with examples:
buildRequest implies that a CCF Record object is instantiated and initialized
with field values taken from the business model objects provided by the
NovaBusinessProcess. When the Record object has been properly
Chapter 7. Migrating a real-life application 89
instantiated and initialized, the byte array that corresponds to this Record
object is extracted into the requestArray field. The byte array conforms to the
COBOL data structure that is used to create this CCF Record object.
Example 7-1 Example of original buildRequest
protected void buildOrderCommentsRequest() throws NovaException {
OrderCommentsReadRequestRecord request =
OrderCommentsCopyhelper.getInstance().build();
bpiFunction = bpiFunctionOrderComments;
request.setIsysidy(applicationid);
request.setIbpigrp(bpiGroup);
request.setIbpifnc(bpiFunctionOrderComments);
request.setReserv16("");
request.setFutuse("");
request.setAppllng(200);
request.setUserid(this.getUserid().trim());
request.setOrderkey(this.getOrderKey());
request.setFill_0("");
// get the byte array for the ECIRequest
requestArray = request.getBytes();
performRequest contains error handling and two lines: a call to buildECI and
a call to flowECI.
Example 7-2 Original performRequest
protected void performRequest()
throws com.ibm.dk.nova.exception.NovaException {
try {
buildECI();
flowECI();
} catch (NovaException ne) {
ApplicationContext.singleton().logException(ne);
System.out.println("CTGCommand.performRequest(), NovaException:
<"+ne+">");
throw ne;
} catch (Exception e) {
ApplicationContext.singleton().logException(e);
System.out.println("CTGCommand.performRequest(), Exception: <"+e+">");
throw new NovaException(e);
}
}
90 CCF-to-J2C Architecture Migration
buildECI: The requestArray field is used to initialize an ECIRequest object, the
object that will be transmitted to the CICS.
Example 7-3 Original buildECI
protected ECIRequest buildECI(byte[] myRequestArray ) throws
com.ibm.dk.nova.exception.NovaException {
String cicsUserid = null;
String cicsPassword = null;
byte[] myCicsCommarea = new byte[CICS_COMMAREA_LENGTH];
int t = myRequestArray.length;
System.arraycopy(myRequestArray, 0, myCicsCommarea, 0,
myRequestArray.length);
return new ECIRequest(ECIRequest.ECI_SYNC_TPN,
transactionserver,
cicsUserid,
cicsPassword,
programname,
transactionid,
myCicsCommarea,
CICS_COMMAREA_LENGTH,
ECIRequest.ECI_NO_EXTEND,
ECIRequest.ECI_LUW_NEW);
}
flowECI: This method uses the CTG JavaGateway to send the ECIRequest to
CICS and awaits the reply. The CTG JavaGateway is wrapped in the
NovaGateway class, which is a singleton that includes fault tolerance and
other services to facilitate a managed environment for the use of the
JavaGateway class.
Example 7-4 Original flowECI
protected void flowECI(ECIRequest myEciRequest, String myBpiFunction, boolean
runningThreadded ) throws com.ibm.dk.nova.exception.NovaException {
com.ibm.bisic.sfw.util.PerformanceTimeSet timeSet = null;
if (timer != null) {
timeSet = new com.ibm.bisic.sfw.util.PerformanceTimeSet();
if (runningThreadded){
timer.addFunction(timeSet);
} else {
Chapter 7. Migrating a real-life application 91
timer.addBackend(timeSet);
}
timeSet.setName(myBpiFunction);
timeSet.setStart();
}
NovaGateway.getInstance().flow(myEciRequest);
if (timeSet != null) {
timeSet.setEnd();
}
// - Check (for ups!) the results
if (myEciRequest.Cics_Rc != 0)
throw new NovaException(
"Cics_Rc=" + myEciRequest.Cics_Rc,
ErrorCodes.ERRCOD_JAVAGW_ECIRC_ERROR,
"CTGCommand.flowECI " + myEciRequest.getCicsRcString() + " " +
myEciRequest.Abend_Code);
if (myEciRequest.Commarea == null)
throw new NovaException(ErrorCodes.ERRCOD_JAVAGW_COMAREA_ERROR,
"CTGCommand.flowECI");
if (myEciRequest.Commarea.length == 0)
throw new NovaException(ErrorCodes.ERRCOD_JAVAGW_COMAREA_ERROR,
"CTGCommand.flowECI");
}
buildResponse works the reverse of the buildRequest method, creating a
business object from the byte array received from CICS. The byte array is
used to initialize a CCF record class, which is used to create the proper
business model objects for the business process in the last try-catch block.
Example 7-5 Original buildResponse
protected void buildOrderCommentsResponse()
throws com.ibm.dk.nova.exception.NovaException {
OrderCommentsReadResponseRecord response = null;
try {
response = new OrderCommentsReadResponseRecord(eciRequest.Commarea);
} catch (com.ibm.record.RecordException re) {
throw new NovaException(
re,
ErrorCodes.ERRCOD_IBMREC_CUSTOMCREATE_ERROR,
this.getClass().getName() + ".buildResponse");
}
Get CCF-to-J2C Architecture Migration now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.