3270 data stream passthrough

This sample program demonstrates using FEPI to passthrough 3270 data stream between a back-end application and a front-end terminal.

On the first invocation of the transaction, a request is sent to the back-end system to start a transaction there. The response is sent on to the front-end terminal.

When there is input from the front-end terminal, CICS reinvokes the transaction. This input is sent on to the back-end system, using the FEPI CONVERSE command, and the resulting response is returned to the front-end terminal.

If there is an error, or the back-end system sends a CICS message, or PF3 is received from the front-end terminal, the transaction ends.

Program logic

Test COMMAREA
If transaction not previously invoked
    Build data stream request to start back-end transaction
    FEPI ALLOCATE conversation with back-end system
    FEPI CONVERSE data stream to and from back-end system
    SEND returned data stream to the front-end terminal
Else
    RECEIVE data stream from the front-end terminal
    Prepare data stream to send on to back-end system
    Reaccess conversation with FEPI ALLOCATE PASSCONVID
    FEPI CONVERSE data stream to and from back-end system
    SEND data stream to the front-end terminal
If error during processing
    SEND explanatory message
If continuing
    Release conversation using FEPI FREE PASS
    RETURN TRANSID(CZTD) with COMMAREA
Else (error, CICS message, or PF3)
    FEPI FREE conversation
    RETURN