View previous topic :: View next topic
|
Author |
Message |
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Hi Experts,
I have a tricky requirement that I believed could be achieved using ENQ DEQ. But looks like its a lot more complex that I thought. Can somebody please help?
My Requirement is that I have a transaction(say EERT) that reads the records in a file one by one and performs some operations until end of the file. But after reading each record the transaction is set to start itself after 1 min and the CICS Return is issued. During this time period of its sleep even if any other txns call ERRT (with the same resource name) I want that to be killed so that the one that will wake up from the sleep will continue processing. I was thinking of using the following ENQ command and issue DEQ only when EOF is reached. But even if I use maxlifetime(Task) option will the DEQ happen automatically when I issue the CICS Return ? Is there any other way I can ensure that only the EERT that went to sleep is able to continue and all other externally triggered EERT txns with the same task resource name gets killed itself ?
Code: |
EXEC CICS
ENQ
RESOURCE (WS-ENQ-VALUE)
LENGTH (WS-ENQ-LENGTH)
RESP (WS-RESP)
TASK
NOSUSPEND
END-EXEC.
IF ENQBUSY
Kill the txn
END-IF |
Sorry for the long message. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You might be able to use a VSAM KSDS record (or TSQ item); write the task number into the record / item; change the program EERT invokes to first read the record / TSQ and if the task number doesn't match then don't proceed. Your explanation is not clear so I'm not completely sure this will work but as long as the transaction is sleeping and not being interval started the method should work. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Robert Sample wrote: |
You might be able to use a VSAM KSDS record (or TSQ item); write the task number into the record / item; change the program EERT invokes to first read the record / TSQ and if the task number doesn't match then don't proceed. Your explanation is not clear so I'm not completely sure this will work but as long as the transaction is sleeping and not being interval started the method should work. |
Thanks for the reply. Writing to TSQ method looks great. But if due to some reason before reaching the end of file if the transaction that has stored its task number in the TSQ gets killed(May be region went down) the TSQ will still have the dead task's number and other transactions also will not be able to run correct ? In that case how long it would take for the TSQ to clear automatically ? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If the region dies, the TSQ probably won't exist any more. In which case you just start a new sequence when the region comes back up. You might want to have a separate transaction check the TSQ every now and then; if you include the timestamp when you write the TSQ item, you can check the timestamp and if so much time has expired assume the original task abended and clear the TSQ so a new sequence can start. |
|
Back to top |
|
|
seahawk789
New User
Joined: 22 Feb 2010 Posts: 56 Location: Cochin
|
|
|
|
Thanks a lot Bob. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Quote: |
But even if I use maxlifetime(Task) option will the DEQ happen automatically when I issue the CICS Return ? |
Just try it.
Logically speaking,
you want to do something like this ?
Code: |
If brand new and not existing one
Do a fresh start-Read File till EoD
else
then resume processing the records from the file till EoF
Kill the brand new trx( task)
end-if
end-if |
Now, to identify if this is a brand new or existing one then save the record to TSQ along with somw flag in first time before you issue a return and then every time your enter the program check the flag id it is there then set it is existing one else brand new and when you see EoF is reached then wipe out all the entries from the TSQ which will tell you the next one coming in is a brand new transation. |
|
Back to top |
|
|
|