IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to ensure the concurrency in TSQ?


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Sat Jun 28, 2014 3:23 pm
Reply with quote

I have a question :

Assume there is a queue Q1 and it has value 5 in ITEM4

Then User A go and read ITEM4 of Q1 add 10 in its value and store it in working storage area . Then User B read ITEM 4 of Q1 add 15 in its initial value and store in its working storage area . Then User A writes and User B also.

I want to know what will be the final value of ITEM 4 , & how does it ensure that anyone data won't lose.

User A READ Q1(ITEM4)
User B READ Q1(ITEM4)
User A WRITE into Q1(ITEM4)
User B WRITE into Q1(ITEM4)
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sat Jun 28, 2014 5:40 pm
Reply with quote

Two users should never ever be able to access the same TSQ for update at the same time, there's something fundamentally wrong with your design!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Jun 28, 2014 7:37 pm
Reply with quote

You need to research ENQ and DEQ CICS API commands.
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Mon Jun 30, 2014 11:41 am
Reply with quote

Hi Prino ,

I got my answer from one of the reply from Mr. Bill .......... Here it is :

You CAN use the same TSQ, although you really should have separate TSQ's.

To guarantee integrity, you must use ENQ and DEQ API's, which enforces serial access, using a RESOURCE name known by every program which accesses the TSQ. Otherwise, TSQ data integrity will be in question, similar to what you're dealing with now.

You may want to review your TSQ naming convention and build the TSQ name unique to the user and the transaction-id.

TSQ names can now be up to 16-Bytes long, so you have the opportunity for uniqueness.

One last recommendation; Delete the TSQ when you're done or issue a DELETEQ (specifying NOHANDLE) when you're about to write the first TSQ Item (TSQ creation).

Commarea usage can replace the TSQ's. If you're short on extra commarea space, take a look at CONTAINERS, introduced with CICS/TS 3.1.

Thank you Mr Bill
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Jun 30, 2014 9:42 pm
Reply with quote

Quote:
Two users should never ever be able to access the same TSQ for update at the same time, there's something fundamentally wrong with your design!


This is very much possible case, and ENQ can be used for transaction sequencing as discussed.

But do you have any better design or solution on this which could be very helpful to know?
Back to top
View user's profile Send private message
ShobhitVerma10april

New User


Joined: 28 Jun 2014
Posts: 21
Location: INDIA

PostPosted: Mon Jun 30, 2014 11:42 pm
Reply with quote

Hi Rohit ,

Read about Shared & Non Shared TSQ. You will get better idea.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Tue Jul 01, 2014 12:40 am
Reply with quote

Hi,

Thanks for the thought but Yes, I am aware of these topologies. Your requirement was how do we get it with same TSQ name as shown "Q1". Hence, Enq was the choice as told by others too, but if you could have asked for more proposed solutions to this problem then as you said Non Shared TSQ, Containers can be more choices left with you.Also it is always not necessary that you will get unique Terminal name in the request and then it goes difficult to maintain unique TSQ name and hence ENQ is generally used for SOA's.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts interesting explanation of DB concurr... General Talk & Fun Stuff 0
No new posts Ensure that all generation of a GDG a... JCL & VSAM 8
No new posts To ensure whether a PDS Member exists... CLIST & REXX 4
No new posts PL1 Error: "ENSURE STRINGS DO N... ABENDS & Debugging 2
No new posts How can I ensure that only 1 user pic... CICS 7
Search our Forums:

Back to Top