Using the EPIRequest class

It is recommended that you use the EPI support classes or the J2EE EPI resource adapter if you are writing programs to interface with CICS® 3270 transactions, because support for the EPIRequest class might be removed in a future release of the CICS Transaction Gateway. However, read this section if you intend to use the EPIRequest class.

When a Java™ Client application connects to CICS using EPI, the application appears to CICS as a 3270 terminal. It is, therefore, important to be aware of the 3270 data streams that might flow in both directions. After an event has been returned to a Java application, the size field of the EPIRequest object indicates the size of the data array returned.

It is also important to be aware of the principles and restrictions governing EPI programming, and to be aware that there might be minor differences in the working of the EPI code on different operating systems. For example, if you are running a CICS Transaction Gateway on Windows®, you will probably need to send Transaction identifiers in the data array of the EPIRequest object, rather than in the EPIRequest object's Transid field.

When getting events from CICS it is recommended that you use the EPI_WAIT option, and ensure that the size field of the EPIRequest object is set to the maximum size of the 3270 data stream that CICS might return.

Parameter lengths: When using the EPIRequest class it is important to note that the parameters have maximum lengths. Any parameters passed exceeding these lengths will be truncated.
Generally, EPI programs written using the CICS Transaction Gateway should:
  1. Open a connection to the Gateway.
  2. Add a terminal.
  3. Start a transaction.
  4. Get an event until one of the following happens:
    • the event received is an end transaction or a converse
    • a severe error is received
  5. If the event received is a converse, send the reply and return to the get event loop.
  6. If the event received is an end transaction, delete the terminal and do a last get event to obtain the end terminal event.
  7. Close the connection to the Gateway.