Key stroke CONVERSE

This sample program demonstrates using FEPI to obtain information from a back-end transaction using the key stroke data format.

On the first invocation of the transaction, a map is sent to the front-end terminal.

When there is input from the front-end terminal, CICS invokes the transaction again. The customer number from the input is built into a key stroke sequence which runs a transaction at the back-end. The key strokes are sent and the results received using a FEPI ALLOCATE-CONVERSE-FREE command sequence. Information is extracted from the results and sent to the front-end terminal. Further input is then awaited.

When PF3 or CLEAR is received from the front-end terminal, the transaction ends. If there is an error, the front-end map is reset. These situations are detected using HANDLE CONDITION.

If the back-end sends a CICS message, it is sent on to the front-end terminal, and the transaction ends.

For clarity, error checking is minimal except for the FEPI commands. Note that the key stroke sequence used involves several attention keys, so that if the intermediate responses are not what is expected, the effects are unpredictable. According to your requirements, it may be advisable to send each attention sequence individually and to check each time that the results are as expected.

Screen

Figure 1. CZTK transaction: customer name and address inquiry
 CZTK                   Customer Name and Address Inquiry
 Please type a customer number in the range 1 through 9999, then Enter.
 Customer Number . . . . .
          Name . . . . . :
          Address. . . . :
          F3=EXIT to CICS

Program logic

  MAIN procedure:
    Test COMMAREA
    If transaction not previously invoked
        Call SEND-NEW-MAP
    Set up exception condition handling:
        Map error - SEND-NEW-MAP
        CLEAR/PF3 - END-PROG
    RECEIVE MAP from front-end terminal
    Build key stroke sequence to:
        clear back-end screen
        type  transaction ID
        ENTER
        type the customer number
        ENTER
    FEPI ALLOCATE conversation with back-end
    FEPI CONVERSE to send key strokes to back-end and get
        the resulting screen image
    FEPI FREE     conversation with back-end
    If CICS message received from back-end
        SEND message to front-end terminal
        RETURN
    Get customer information from back-end screen image
    Build data for front-end terminal map
    SEND map data to front-end terminal
    RETURN TRANSID(CZTK) with COMMAREA
  SEND-NEW-MAP routine:
    SEND new map to front-end terminal
    RETURN TRANSID(CZTK) with COMMAREA
  END-PROG routine:
    Clear front-end terminal
    RETURN