DFHCOMMAREA



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

DFHCOMMAREA

Postby VIJAY1 » Mon Nov 19, 2012 3:17 pm

Can some one explain me where dfhcommarea comes into use while programming with an example..
I understood theoritically but coming to the application part,i am not positive.
Thanks in advance.
VIJAY1
 
Posts: 26
Joined: Sun Oct 21, 2012 2:49 pm
Has thanked: 3 times
Been thanked: 0 time

Re: DFHCOMMAREA

Postby Robert Sample » Mon Nov 19, 2012 3:34 pm

Your question is so broad as to be meaningless. DFHCOMMAREA is, in general, used by an application program (or programs) in a CICS system for transferring data between programs. What data will depend entirely upon the application.

One common use with pseudo-conversational programs is to indicate what the program needs to do. The program may start the PROCEDURE DIVISION by testing EIBCALEN and if it is zero, send a map and then EXEC CICS RETURN TRANSID('XXXX') COMMAREA(<working-storage area>) so when the terminal user hits the enter (or other attention) key and the program starts again EIBCALEN will not be zero and the program logic can then receive the map sent the first time through the code.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: DFHCOMMAREA

Postby c62ap90 » Tue Nov 20, 2012 6:10 am

Robert is correct. The question is so broad it's hard to give a specific answer. Here is however a snippet of code to possibly put DFHCOMMAREA in context.
You may notice "MOVE DFHCOMMAREA TO WS-COMMAREA" {Linkage to WS}. This is not really needed. You can work completely (more or less) out of DSHCOMMAREA for passing information but I always liked the two for before/after comparisions if needed.
As Robert mentioned - DFHCOMMAREA is for passing data.
       01  FILLER  PIC X(30)   VALUE 'WS-COMMAREA        BEGINS HERE'.
       01  WS-COMMAREA.
           10  WS-COMM-XXXX-TRANSID    PIC X(04).
           10  WS-COMM-PROCESS-SW      PIC X(01).
               88  WS-COMM-FIRST-TIME-IN   VALUE '0'.
               88  WS-COMM-REENTRY         VALUE '1'.
               88  WS-COMM-REENTRY-ERROR   VALUE 'E'.
           EJECT
           COPY DFHAID.
           EJECT
           COPY DFHBMSCA.
           EJECT
       01  FILLER  PIC X(23)   VALUE 'pgm name WS ENDS HERE'.
           EJECT
     
 
      *---------------------------------
      *
       LINKAGE     SECTION.
      *
      *---------------------------------
      *
CICS   01  DFHCOMMAREA.
CICS       10  LS-COMM-XXXX-TRANSID    PIC X(04).
CICS       10  LS-COMM-PROCESS-SW      PIC X(01).
CICS           88  LS-COMM-FIRST-TIME-IN   VALUE '0'.
CICS           88  LS-COMM-REENTRY         VALUE '1'.
CICS           88  LS-COMM-REENTRY-ERROR   VALUE 'E'.

           EJECT
CICS   PROCEDURE DIVISION    USING DFHEIBLK
CICS                               DFHCOMMAREA.
      *****************************************************************
      *              P R O C E D U R E   D I V I S I O N              *
      *****************************************************************

      *--- CLEAR SCREEN AND DISPLAY END MESSAGE AT TOP OF SCREEN.
CICS       IF  (IEBAID          = DFHCLEAR OR
CICS                              DFHPF3)
               GO  TO 999-END-SESSION
           END-IF.

CICS       MOVE DFHCOMMAREA    TO WS-COMMAREA.

      *--- TRAP GENERAL ERRORS
CICS       EXEC CICS HANDLE CONDITION
CICS                 ERROR     (900-SYSTEM-ERROR)
CICS                 LENGERR   (915-LENGTH-ERROR)
CICS                 MAPFAIL   (920-MAPFAIL-ERROR)
           END-EXEC.

      *--- INITIALIZE MAP/SCREEN
           MOVE LOW-VALUES     TO XXXXXXXO.
           EJECT
      *--- MAP XXXXXXXX
           EVALUATE WS-COMM-PROCESS-SW

               WHEN '1'
      *--- RE-ENTRY
                   MOVE '004'          TO WS-HOLD-PARAGRAPH-NUM
                   PERFROM 810-RECEIVE-MAP-XXXXXXXX

                   EVALUATE EIBAID

                       WHEN DFHPF5
etc...
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 7 times

Re: DFHCOMMAREA

Postby mongan » Tue Nov 20, 2012 1:34 pm

c62ap90 what you said is very dangerous :o . You can work with the DFHCOMMAREA ONLY if you are sure you have one available (EIBCALEN is not 0 and is equal to the expected size that you are working with), otherwise you will be causing storage violations in CICS which can endanger your entire CICS system !!!!!!!!!!! :!: :!: :!: :!:
User avatar
mongan
 
Posts: 211
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times

Re: DFHCOMMAREA

Postby c62ap90 » Tue Nov 20, 2012 9:22 pm

mongan wrote:c62ap90 what you said is very dangerous :o . You can work with the DFHCOMMAREA ONLY if you are sure you have one available (EIBCALEN is not 0 and is equal to the expected size that you are working with), otherwise you will be causing storage violations in CICS which can endanger your entire CICS system !!!!!!!!!!! :!: :!: :!: :!:

Danger is my middle name!

Yep, I agree with you. I mention this since I see a fair amount of CICS programs referencing both the WS-COMMAREA and LS-(DFHCOMMAREA) field names interchangeably as if they are exactly the same data and most of the time it's "okay" but why risk, for example, a storage violation.

Do the "MOVE DFHCOMMAREA TO WS-COMMAREA." and reference WS- field names in your module.
Just remember to "MOVE WS-COMMAREA TO DFHCOMMAREA." on the way "out"/GOBACK.

Thanks.
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 7 times

Re: DFHCOMMAREA

Postby mongan » Fri Nov 23, 2012 9:10 pm

Again, that move back can be dangerous if the EIBCALEN is not correct, the safest method is to ALWAYS build your commarea from working-storage.
User avatar
mongan
 
Posts: 211
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times

Re: DFHCOMMAREA

Postby dstaudacher » Tue Feb 26, 2013 7:45 am

" the safest method is to ALWAYS build your commarea from working-storage."

The best and safest way is to not have it in WORKING-STORAGE in the first place. Use this code, just after the PROCEDURE DIVISION statement in your top-level program:

IF EIBCALEN = 0
EXEC CICS GETMAIN SET (ADDRESS OF DFHCOMMAREA)
LENGTH (LENGTH OF DFHCOMMAREA) END-EXEC
END-IF

Now you have only ONE copy of the Commarea - always in Linkage - and you don't have to worry about moving it back and forth anymore or whether the correct and most current data is in Working Storage or Linkage. It's ALWAYS in Linkage.
dstaudacher
 
Posts: 6
Joined: Tue Feb 26, 2013 7:31 am
Has thanked: 1 time
Been thanked: 0 time


Return to CICS

 


  • Related topics
    Replies
    Views
    Last post