I am trying to avoid two simultaneously invoking of the same transaction(ABCD). User1 chooses the option 1 from CICS screen to invoke the tran 'ABCD'. Option1 invokes the program PRGM1.I used 'ENQ' command in my program PRGM1 which start the Tran ‘ABCD’. Tran 'ABCD' ideally invokes the program PRGM2(it is mapped with tran 'ABCD'). The LOCK which is taken by the ENQ command is getting released whenever program PRGM2 throws any map or calls any program. At this time, user2 is able to invoke the same Tran 'ABCD'.
I tried using INQUIRE TASK LIST command in PRGM1 to check if Tran ‘ABCD’ is already running. so that i can throw some error message from PRGM1 to the screen.This command is not retrieving the Tran 'ABCD' in its list.
FYI. PGRM2 is CICS program and designed using Pseudo conversation.
Could anybody please help me to take the LOCK on Tran 'ABCD' until the program PRGM2 (associated with the Tran 'ABCD') completes its work?
You can suggest me alternative way also to make sure that PRGM2 is executed by one user at a time until it completes its work.
the whole concept of CICS is to allow more than one user to use the same program simultaneously
But i want to restrict our users to simultaneously invoke ONLY the tran 'ABCD' not all the options(Tran ID) in our application Menu. If they invoke the tran 'ABCD' simultaneoulsy, it makes some unwanted entry in more than one datacom table. I dont want it to happen.
Mean time, i will try to find the option to handle this situation in the program PRGM2 itself.
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
Review TRANCLASS, where you can set the max active tasks (such as 1), associated with a given transaction, allowing single transaction (serial) execution.
However, care must be taken because if the target transaction could potentially be of random high-use (usage spike) and/or is inherently long running, then this could be detrimental to the entire region overall.
Speak with system's personnel so they can work up some metrics on this transaction's use and average response time and come to a conclusion whether a unique TRANCLASS would be one method of serialisation.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
If they invoke the tran 'ABCD' simultaneoulsy, it makes some unwanted entry in more than one datacom table.
All this says is there is a design flaw. . .
You do not have a cics issue (imho), you have a database processing issue.
How often does it happen that multiple users need to run this transaction at the same time?
What we have done at several of my Datacom clients to resolve this (others have made the same mistake) is to read a particular row in some control table (if one does not exist, create one). Read the row used to control this single-threading for the abcd process with lock/update. Once the process completes, free the row. This read for update would have to be put into every process that could invoke the abcd process. If there is only one, there would be very little to change in the existing code.