View previous topic :: View next topic
|
Author |
Message |
chaitrasmurthy
New User
Joined: 22 Feb 2010 Posts: 5 Location: Bangalore
|
|
|
|
Hi All,
I need to delete the contents of TSQ so that I can re-write to the queue again with no contents in it. However, I dont want to delete the queue. Just want to clear the TSQ (clear the contents in TSQ). How can I achieve it? |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi chaitrasmurthy,
Your question seems to be pretty straightforward. If you have tried using TSQ certainly you would have seen the DELETEQ TS command.
Wouldn't that achieve your requirement ?
Please have look into the manuals for more details. |
|
Back to top |
|
|
chaitrasmurthy
New User
Joined: 22 Feb 2010 Posts: 5 Location: Bangalore
|
|
|
|
Well, if DELETEQ TS deletes only the contents of TSQ, then how do we delete the TSQ itself?
Ex - Say, I have TSQ 'SAMPLE'. My requirement is to write some contents into TSQ and on execution of a particular command say CLEAR, I need to delete the contents of TSQ and start writing into the queue, the data for the next commands issued by the user. At the end of the transaction, I need to delete the queue (Mean to say, I shouldnt have any queue by name 'SAMPLE').
So, I need to perform 2 operations on whole, just delete the contents of TSQ at some stage and at the end delete TSQ itself. May I know which purpose out of the two will be served by using DELETEQ TS? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
The only way you could do this and save the current TSQ, would be to determine whether the TSQ only has one ITEM/RECORD (via the READQ TS API NUMITEMS halfword). If this is true, then you can re-initialize this single ITEM to a chosen value (such as LOW-VALUES), followed by a REWRITE.
Otherwise, follow Binop's post.
FWIW, the DELETEQ API deletes the entire TSQ itself, not just the contents....
Bill |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi chaitrasmurthy
TSQ's are temporary storage queues. and since its temporary (and if my understanding is correct... ) functionally there should not be much difference between cleaning up the queue or deleting it. Probably if you tell us how the TSQ is used in other places maybe we might understand your concern.
Also i suggest you could have a re-look into the manual. That might sometimes clear your doubts... |
|
Back to top |
|
|
chaitrasmurthy
New User
Joined: 22 Feb 2010 Posts: 5 Location: Bangalore
|
|
|
|
Bill,
For my requirement, I will be writing records from database. So, its just not a single record. TSQ can have many records. Suppose, I already have 20 records in TSQ and once I start re-writing, the next database fetch might only have 10 records. In that case, I ll have 11-20 records which is the result of previous command executed which would be misleading. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Bill O'Boyle wrote: |
The only way you could do this and save the current TSQ, would be to determine whether the TSQ only has one ITEM/RECORD (via the READQ TS API NUMITEMS halfword). If this is true, then you can re-initialize this single ITEM to a chosen value (such as LOW-VALUES), followed by a REWRITE.
Otherwise, follow Binop's post.
FWIW, the DELETEQ API deletes the entire TSQ itself, not just the contents....
Bill |
Oh... So that's what chaitrasmurthy was trying to do... to keep the records in the queue as such and clear each record... Silly Me !! |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
chaitrasmurthy wrote: |
Bill,
For my requirement, I will be writing records from database. So, its just not a single record. TSQ can have many records. Suppose, I already have 20 records in TSQ and once I start re-writing, the next database fetch might only have 10 records. In that case, I ll have 11-20 records which is the result of previous command executed which would be misleading. |
Nope... back to square 1 !!!
I think my initial understanding was correct...
@chaitrasmurthy.. I suggest as of now that you do the DELETEQ TS before your "database read and TSQ update" and see how its working. Am pretty much confident now that it will work to your liking... |
|
Back to top |
|
|
chaitrasmurthy
New User
Joined: 22 Feb 2010 Posts: 5 Location: Bangalore
|
|
|
|
Alright. Thanks for your time. Once I delete the queue and issue a write command, the queue will again be created. So, that should solve my problem. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
chaitrasmurthy wrote: |
Alright. Thanks for your time. Once I delete the queue and issue a write command, the queue will again be created. So, that should solve my problem. |
Exactly... that's how TSQ's work !!
Glad that we could be of help.. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Since CICS/OS 1.7 (late 1980's), the CICS folks introduced RESP and/or NOHANDLE to CICS API's.
So, if you're issuing a DELETEQ TS, don't define a HANDLE CONDITION QIDERR as this generates (as all other HANDLE CONDITION API's) an internal CICS GETMAIN.
If you specify NOHANDLE in your DELETEQ TS API, you're informing CICS that you don't care if the TSQ exists or not (and you probably don't) and plus, you'll eliminate the HANDLE CONDITION and the GETMAIN.
Bill |
|
Back to top |
|
|
chaitrasmurthy
New User
Joined: 22 Feb 2010 Posts: 5 Location: Bangalore
|
|
|
|
Thanks for the info. |
|
Back to top |
|
|
|