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

Module 5: CICS BMS and Screens


BMS COBOL Program

How a COBOL program uses BMS

  • COPY the symbolic map (the generated copybook) into Working-Storage - for example COPY MNTSET1.
  • To display: MOVE values to the output fields (suffix O), then SEND MAP FROM the O area.
  • To read input: RECEIVE MAP INTO the I area, then read the xxxI data fields and xxxL length fields.
  • COPY DFHAID for the attention-key constants (DFHENTER, DFHPF3, DFHCLEAR, DFHPA1...) and test EIBAID to see which key the user pressed.

Typical program flow

  • First execution (EIBCALEN = 0): move LOW-VALUE to the O area, SEND MAP with ERASE to show a fresh screen, then RETURN with TRANSID and COMMAREA.
  • Next execution: check EIBAID. On Enter, RECEIVE MAP, validate the input, process it (READ/WRITE the file), SEND MAP the result, and RETURN again.
  • On invalid input, move an error message to the message field, move -1 to the bad field's length item, and SEND MAP with DATAONLY, ALARM and CURSOR.
  • On F3/F12, XCTL back to the menu program or RETURN to CICS instead of redisplaying the map.

Keeping maps and programs in sync

  • If the mapset changes, reassemble it and recompile every program that COPYs its symbolic map.
  • Keep the map and mapset names identical between the BMS source and every SEND MAP / RECEIVE MAP in the program.
  • A hand-coded symbolic map is allowed, but BMS will not keep it in sync for you - the generated map is safer.
  • Example:-
    COPY MNTSET1. COPY DFHAID. * EXEC CICS RECEIVE MAP('MNTMAP1') MAPSET('MNTSET1') INTO(MNTMAP1I) END-EXEC. * MOVE 'That customer does not exist.' TO MSG1O MOVE -1 TO CUSTNO1L EXEC CICS SEND MAP('MNTMAP1') MAPSET('MNTSET1') FROM(MNTMAP1O) DATAONLY ALARM CURSOR END-EXEC.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant