JEE EPIPlayScript sample

This sample uses the EPI resource adapter and drives a CICS® terminal using a command script interpreted by the CCI enterprise bean.

The EPIPlayScript sample program includes the following files:
EPIPlayScriptBean.java
The EPIPlayScript implementation code
EPIPlayScript.java
The Remote interface
EPIPlayScriptHome.java
The Home interface
CICSCESNLogon.java
A sample logon/logoff class to drive the CICS transaction CESN via the terminal
EPIPlayScriptClient.java
The client for the enterprise bean
Enterprise beans have a main body of code and two interfaces. EPIPlayScriptClient looks up the enterprise bean as EPIPlayScriptBean1 in Java™ Naming Directory Interface (JNDI), and then narrows the search to a specific object using the remote interface as a type-cast. When execute() is called on this interface, the method is called remotely on the enterprise bean. This remote method in turn looks up the resource adapter's connection factory (an instance of the RA) under the name EPI and then uses a simple script to drive a CICS terminal.

The script commands consist of a letter and a bracketed argument. The script is provided as string by the EPIPlayScriptClient application.

Commands are as follows:
S(xxxx)
Start Transaction xxxx
F(nn)=text
Set field number nn to text.
P(aid)
Press key aid. An AID key is a function key in a CICS terminal, such as Enter or Clearscreen. See Class AIDKey for the available keys.
C(row,col)
Set the cursor to row,col.
R(field)
Returns the value of field as a string array.
The script provided by the client is as follows:
S(EP02)P(enter)P(enter)P(enter)P(enter)R(2)R(6)
To run this sample program:
  1. Deploy the CICS EPI resource adapter. This is a file called cicsepi.rar in the <install_path>/deployable directory.
  2. Create a connection factory with parameters that are valid for your CICS server environment (on WebSphere® Application Server, these settings are on the Custom properties tab of the J2C connection factory settings). See Deploying CICS resource adapters for more information. The connection factory must have a JNDI name of "EPI" for the sample program to work.
  3. Deploy the EPIPlayScript sample. The sample is a file called EPIPlayScript.ear and is located in the <install_path>/deployable directory. You might also need to set these properties:
    EJB type
    EPIPlayScript is a stateful session bean.
    JNDI name
    The enterprise bean is looked up by the enterprise client through JNDI. This allows the enterprise client to find the bean in the directory. The EPIPlayScriptClient requires this name to be set to "EPIPlayScriptBean1".
    Resource References
    The enterprise bean refers to another resource, the EPI resource adapter. To enable this to happen:
    1. Deploy a ConnectionFactory for the EPI resource adapter with a JNDI name of "EPI".
    2. This ConnectionFactory should then be listed as a resource reference for this enterprise bean.
  4. If your terminal is sign-on capable, include com.ibm.ctg.samples.jee.CICSCESNLogon as your LogonLogoff class. Place this in the application. See Using a Java 2 Security Manager for information about security privileges that you might need to grant to your enterprise bean.
  5. Run the client application. You can run it from a command line, but if you are using WebSphere, use the launchClient utility. This sets up the necessary parameters to allow the enterprise client to look up the bean in the JNDI directory in WebSphere to find the EPIPlayScript bean. The application returns two fields from the EP02 screen:
    • Start of change The number of times the EP02 has been run, which is five (Transaction started, then enter was pressed four times) End of change
    • The current time

Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/J2EEEPIPlayScriptSample.html