Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 15: CICS Real-World Projects and Interview Preparation


Customer Inquiry Transaction

A customer inquiry transaction is the classic first CICS project: the user types an account or customer number, and the program displays the stored details.

It follows the key-map / data-map design from the CICS program design material: a key map collects the number, a data map shows the record.

Designing the inquiry transaction

  • Give the transaction a trans-id such as INQ1, started from the menu program or typed directly.
  • First display shows the key map with one input field: the customer number.
  • The user enters the number and presses Enter; the program reads the file and shows the data map with name, address and balance.
  • PF3 returns to the menu program. PF12 on the key map returns to the menu; PF12 on the data map redisplays the key map.
  • The program is pseudo-conversational: SEND the map, then RETURN TRANSID('INQ1') to wait for the response.

Reading the customer record

  • EXEC CICS READ FILE('CUSTMAS') INTO(...) RIDFLD(WS-CUST-NO) reads the record by key.
  • Always check RESP. DFHRESP(NOTFND) means the number does not exist - show an error message, do not abend.
  • Move the file fields into the symbolic map fields, then SEND the data map.
  • For display-only output use MAPONLY on the SEND so no input data is expected back.
  • Keep the file read and the SEND in the same task, but do not lock the record - a plain READ without UPDATE is enough for inquiry.
  • Example:-
    EXEC CICS READ FILE('CUSTMAS') INTO(CUSTOMER-MASTER-RECORD) RIDFLD(WS-CUST-NO) RESP(WS-RESP) END-EXEC. IF WS-RESP = DFHRESP(NORMAL) MOVE CM-FIRST-NAME TO FNAMEO MOVE CM-LAST-NAME TO LNAMEO MOVE CM-BALANCE TO BALO EXEC CICS SEND MAP('INQMAP') MAPSET('INQSET') ERASE END-EXEC ELSE MOVE 'CUSTOMER NOT FOUND - TRY AGAIN' TO MSGO END-IF.

Sending the map to the terminal

  • EXEC CICS SEND MAP('INQMAP') MAPSET('INQSET') ERASE paints the map and clears the screen.
  • After SEND, issue EXEC CICS RETURN TRANSID('INQ1') COMMAREA(...) so the next Enter restarts the program.
  • On restart, EIBCALEN tells whether a COMMAREA arrived; zero means this is the first entry.
  • RECEIVE MAP reads the user's input back into the symbolic map fields.
  • Use the CURSOR option or set the cursor position so the cursor lands in the customer-number field on the key map.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant