Data in DFHCOMMAREA



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

Data in DFHCOMMAREA

Postby Pumpkin » Sat Sep 17, 2011 7:51 am

hi,guys
i am new to cics programming, and i have a question about data stored in DHFCOMMAREA, does this value remain unchanged until new data move in or the session end?

for example,
----------------------------
working-storage section
01 ca-data pic x.
linkage section
01 dfhcommarea pic x.
.
.
exec cics
return transid('xxxx')
commarea(ca-data)
end-exec
-----------------------------------
fisrt time, i move 'y' to ca-data, so second time start, i get 'y' from dfhcommarea. but next time ,i didn't move anydata to ca-data, so i think ca-data should contain low-value(i am not sure), so start again, dfhcommarea still contain 'y' , why not be relpaced by low-value? thanks!
-------------------
Pumpkin
Pumpkin
 
Posts: 55
Joined: Sat Mar 05, 2011 9:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Data in DFHCOMMAREA

 

Re: Data in DFHCOMMAREA

Postby BillyBoyo » Sat Sep 17, 2011 2:35 pm

Think of two users using your transaction.

Both start working, then the first goes for a cup of tea. When they return the second goes for a cup of tea and the first starts working again. As your program is invoked, the commarea you have in the linkage section is from the first user, and the commarea you have in working-storage is from the second user.

So, you don't want to use the commarea beloning to the wrong user (we called this "cross-talk"). Don't look at the commarea in working-storage until after you have moved the commarea from the linkage section to it. Then you won't have any problems.

You are not, or not necessarily, starting with a fresh copy of the Cobol program each time your transaction is used. The data is left from the previous use, which can (very easily) be from a different user/terminal. For this reason you keep stuff that you need to keep associated with the user in the commarea in the linkage section (by moving back from working-storage before you leave the program).

If you think of it as one linkage section commarea for each user of your transaction, but only one working-storage commarea for all the users, you should be able to get a grip on it.

Don't rely on the previous value of anything in the working-storage. If you need to rely on a previous value, it has to be in the commarea which you then move to the linkage section commarea (or on a file, database, queue etc, not in the w-s).
BillyBoyo
Global moderator
 
Posts: 3759
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 256 times

Re: Data in DFHCOMMAREA

Postby Pumpkin » Sun Sep 18, 2011 4:44 pm

thanks for the explain !
-------------------
Pumpkin
Pumpkin
 
Posts: 55
Joined: Sat Mar 05, 2011 9:12 am
Has thanked: 0 time
Been thanked: 0 time

Re: Data in DFHCOMMAREA

Postby mongan » Mon Sep 19, 2011 12:48 pm

Please examine other threads on the DFHCOMMAREA and Storage Violations. You should always check to see if you actually have received a DFHCOMMAREA in your transaction (EIBCALEN tells you how large it is, 0 means you have none) and if you have none or want to enlarge the size then you MUST create it from working storage.
User avatar
mongan
 
Posts: 212
Joined: Tue Jan 11, 2011 8:32 pm
Has thanked: 1 time
Been thanked: 5 times


Return to CICS

 


  • Related topics
    Replies
    Views
    Last post