01.01.2013 Views

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

CICS Transaction Gateway V5 The WebSphere ... - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

346 <strong>CICS</strong> <strong>Transaction</strong> <strong>Gateway</strong> <strong>V5</strong><br />

<strong>The</strong> next section of code enables <strong>CICS</strong> TG Java client tracing if the tracing<br />

parameter is set to on (Figure B-8).<br />

if(trace.equals("on"))<br />

{<br />

T.setDebugOn(true);<br />

}<br />

else<br />

{<br />

T.setDebugOn(false);<br />

}<br />

Figure B-8 Enabling <strong>CICS</strong> TG Java client tracing<br />

<strong>The</strong> next section instantiates a Java<strong>Gateway</strong> object, using the URL and port of the<br />

<strong>Gateway</strong> as given in the input to the servlet. This automatically connects to the<br />

<strong>Gateway</strong> daemon so no openJava<strong>Gateway</strong>() method call is needed. Note that<br />

this, along with the other <strong>CICS</strong> TG Java method calls, is enclosed in a try catch<br />

block, so we catch any exceptions that occur.<br />

We then convert the input COMMAREA data into a byte array using the encoding<br />

specified in the form. We then create an ECIRequest object using the parameters<br />

previously input and flow the request to the <strong>CICS</strong> server, as shown in Figure B-9.<br />

// create the ECI Request<br />

eciRequest =<br />

new ECIRequest(<br />

ECIRequest.ECI_SYNC,<br />

cicsServer,<br />

username,<br />

password,<br />

funcName,<br />

mirror,<br />

abCommarea,<br />

commareaLengthInt,<br />

ECIRequest.ECI_NO_EXTEND,<br />

ECIRequest.ECI_LUW_NEW);<br />

// indicate progess<br />

progress += "Flowing ECI request to server";<br />

// send the request to <strong>CICS</strong><br />

jgaConnection.flow(eciRequest);<br />

Figure B-9 Creating an ECIRequest and flowing it to <strong>CICS</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!