Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Using ENQ command with Maxlifetime(Task) option

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
seahawk789

New User


Joined: 22 Feb 2010
Posts: 47
Location: Cochin

PostPosted: Wed Jul 29, 2015 6:58 am    Post subject: Using ENQ command with Maxlifetime(Task) option
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: 7905
Location: Bellevue, IA

PostPosted: Wed Jul 29, 2015 8:01 am    Post subject:
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: 47
Location: Cochin

PostPosted: Wed Jul 29, 2015 8:16 am    Post subject:
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: 7905
Location: Bellevue, IA

PostPosted: Wed Jul 29, 2015 8:59 am    Post subject:
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: 47
Location: Cochin

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

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

Senior Member


Joined: 21 Sep 2010
Posts: 1609
Location: NY,USA

PostPosted: Wed Jul 29, 2015 9:16 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts BWO option in VSAM blayek CICS 3 Sat Nov 05, 2016 10:47 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts SDSF Command Avtrix CLIST & REXX 4 Fri Sep 30, 2016 11:13 am
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us