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

Using ENQ command with Maxlifetime(Task) option


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

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Wed Jul 29, 2015 6:58 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jul 29, 2015 8:01 am
Reply with quote

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
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Wed Jul 29, 2015 8:16 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jul 29, 2015 8:59 am
Reply with quote

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
View user's profile Send private message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 56
Location: Cochin

PostPosted: Wed Jul 29, 2015 9:00 am
Reply with quote

Thanks a lot Bob.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Wed Jul 29, 2015 9:16 pm
Reply with quote

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
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 RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts SCOPE PENDING option -check data DB2 2
No new posts LTJ command CA Products 4
Search our Forums:

Back to Top