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

Module 8: CICS Program and Data Passing


COMMAREA

What is a COMMAREA

  • COMMAREA is short for Communication Area.
  • It is a data area used to pass data from one CICS program to another.
  • You name it on the LINK, XCTL or RETURN command with the COMMAREA option.
  • The program that receives it must define a field named DFHCOMMAREA in its Linkage Section.
  • CICS puts the length of the COMMAREA in the EIBCALEN field (S9(4) COMP).
  • Always check EIBCALEN before using DFHCOMMAREA.

How a program receives a COMMAREA

  • Define 01 DFHCOMMAREA in the Linkage Section with the same layout as the sender uses.
  • On the very first execution of a pseudo-conversational program, EIBCALEN is 0.
  • When EIBCALEN is 0, DFHCOMMAREA contains LOW-VALUES. Move your working area there after the first screen display.
  • If you forget the EIBCALEN check, your program may use garbage data on the first run.
  • Example of receiving and sending a COMMAREA:-
    LINKAGE SECTION. 01 DFHCOMMAREA PIC X(200). PROCEDURE DIVISION. 0000-MAIN-PARA. IF EIBCALEN = 0 MOVE LOW-VALUES TO WS-COMM-AREA ELSE MOVE DFHCOMMAREA TO WS-COMM-AREA END-IF. . . EXEC CICS LINK PROGRAM('PROG2') COMMAREA(WS-COMM-AREA) LENGTH(200) END-EXEC.

How a program sends a COMMAREA

  • Use the COMMAREA(data-name) option on LINK, XCTL or RETURN.
  • Always give the LENGTH option with the number of bytes being passed.
  • Both the sending and receiving programs must agree on the layout.
  • The LENGTH you pass must not be larger than the DFHCOMMAREA defined by the receiver.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant