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

Module 8: CICS Program and Data Passing


Passing Data Between Programs

Ways to pass data between CICS programs

  • COMMAREA: one flat data area passed on LINK, XCTL or RETURN. Simple, but both programs must agree on the layout.
  • CHANNEL with CONTAINERs: many named data items passed on LINK, XCTL, START or RETURN. Flexible and easy to extend.
  • CICS storage areas: CWA, TWA and TCTUA. Shared storage reached with the ADDRESS command.
  • Temporary storage queues: one program writes, another reads. Good for larger data.
  • Files and DB2 tables: pass a key in the COMMAREA and let each program read the record itself.

COMMAREA vs CHANNEL - which to use

  • Use COMMAREA for small, fixed data where both programs are written together.
  • Use CHANNEL when the data has many parts, or when different programs need different parts.
  • Use CHANNEL when the called program must send changed data back to the caller.
  • Adding a container never breaks existing programs. Changing a COMMAREA layout can break them.
  • For new development, CHANNEL is the recommended approach.

Sharing data with CWA, TWA and TCTUA

  • CWA is the Common Work Area. It is shared by all tasks in the CICS region.
  • TWA is the Transaction Work Area. It belongs to the current task.
  • TCTUA is the Terminal Control Table User Area. It belongs to the terminal.
  • Use the ADDRESS command to get addressability to these areas through the Linkage Section.
  • Example of using the CWA:-
    LINKAGE SECTION. * 01 DFHCOMMAREA PIC X. * 01 COMMON-WORK-AREA. * 05 CWA-CURRENT-DATE PIC X(8). 05 CWA-COMPANY-NAME PIC X(30). * PROCEDURE DIVISION. * 0000-PROCESS-CUSTOMER-INQUIRY. * EXEC CICS ADDRESS CWA(ADDRESS OF COMMON-WORK-AREA) END-EXEC. MOVE CWA-COMPANY-NAME TO COMPO.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant