View previous topic :: View next topic |
Author |
Message |
SK2007 Beginner
Joined: 25 Jan 2007 Posts: 40 Topics: 17
|
Posted: Wed Jul 16, 2008 3:23 pm Post subject: Locking/Unlocking |
|
|
Hi All,
I have the following problem. Any suggestion is greatly appreciated.
In online(CICS) if user is editing one screen, the system will write user details and screen details he is editing, to one DB2 table(locking table).
If sytem gets timedout, I need to delete these details from locking table.
How to do this? how does the system recognise when the sytem gets time out.
Thanks for your help as always.
SK2007. |
|
Back to top |
|
|
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Thu Jul 17, 2008 3:02 am Post subject: |
|
|
To answer your question: your program receives a DB2 sqlcode, if the reason for the timeout is in DB2. Then simply issue a ROLLBACK and nothing of this unit of work is stored in DB2.
But obviously you don't have a "transactional design" for the work you have to fullfill, i.e. you don't have a finished piece of work when you send the user the next screen and therefore you have to issue a DB2 commit in between your application work.
If you have multiple panels, which details have to be stored in DB2, you should additionally write a "work completed" status into the DB2 table. Interpreting the results, you don't use the entries which don't have this status set.
regards
Christian |
|
Back to top |
|
|
SK2007 Beginner
Joined: 25 Jan 2007 Posts: 40 Topics: 17
|
Posted: Thu Jul 17, 2008 7:29 am Post subject: |
|
|
CZerfas,
Thanks for your response. I think I didn't give more details.
I am getting system timeout means..mainframe system timeout not DB2 timeout.
Suppose if user is editing one member details in online, and if he is not performing anything for 15 minutes, the mainframe system will get timeout. In this case I need to remove the entry from locking table.
How to do this? how does the program recognise when the mainframe sytem gets timed out.
Thanks
SK2007. |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Jul 17, 2008 9:09 am Post subject: |
|
|
if your lock entry contains a time, why not check the time? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
SK2007 Beginner
Joined: 25 Jan 2007 Posts: 40 Topics: 17
|
Posted: Thu Jul 17, 2008 12:14 pm Post subject: |
|
|
Yes, lock entry has time entry. When user enters the edit screen, user details will be written to lock table with timestamp. But I am not sure how to check this time when mainframe gets time out.
I don't know much in Db2. I am just starter.
Would it be possible to give the code to handle this situation?
Thanks
SK2007 |
|
Back to top |
|
|
WallaceC Beginner
Joined: 17 Dec 2002 Posts: 22 Topics: 10
|
Posted: Thu Jul 17, 2008 1:01 pm Post subject: |
|
|
Possible return codes on timeout when running a query:
Quote: |
1) SQLCODE -911
Explanation: The current unit of work was the victim
in a deadlock, or experienced a timeout, and had to be
rolled back.
2) SQLCODE -913
Explanation: The application was the victim in a
deadlock or experienced a timeout. The reason code
indicates whether a deadlock or timeout occurred.
|
Since either SQLCODEs are related to resources not available at the moment, your program should contain logic to evaluate the return code after running the query. If getting either return codes, the program could either abend immediately or try to rerun the query, i.e. performing restart. If abend immediately, you can try rerunning the program. If same abend occurs, I will suggest to contact your DBA immediately for assistance. If you want to include the restart logic in your program, remember to set restart limit to avoid program from running in loop. |
|
Back to top |
|
|
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Thu Jul 17, 2008 3:11 pm Post subject: |
|
|
Wallace,
SK2007 is not getting a DB2 timeout. It's a TSO timeout. Something is seriously wrong with a design that allows a user to lock a DB2 table while they get up and take a 15 minute break from their terminal. I suggest a design change. CICS programs should be pseudo-conversational with appropriate DB2 commits (CICS syncpoints) at the end of a logical unit of work. _________________ ....Terry |
|
Back to top |
|
|
|
|