Author |
Message
|
bijal.awhad |
Posted: Mon Dec 08, 2008 12:25 am Post subject: MQseries- writing record in vsam as soon as read form MQ |
|
|
Newbie
Joined: 08 Dec 2008 Posts: 3
|
Hi
I want to write the message that has been read from Q in vsam file.
Program logic is as below
1. Open Q
2. Read Q
3.Close Q
4. Write to Vsam file
Now what is happening is as soon as messgae is read from the Q , that messgae is no longer available in Q.Now if in case if message is not written to vsam (due to some error) i will miss the record as it is not available in Q any more.
Requirement is The read transaction should not be completed successfully until the record is written to the VSAM file. If the read transaction does not complete, the record should remain on the queue.
Is there any way to keep the message in the Q when there is an error while writing to vsam and delete the message from Q when vsam write is successful.
How should i do this? I am new to MQ. If i get sample code that will be great help..
Thanks
Bijal |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 08, 2008 12:32 am Post subject: Re: MQseries- writing record in vsam as soon as read form MQ |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bijal.awhad wrote: |
Now what is happening is as soon as messgae is read from the Q , that messgae is no longer available in Q.Now if in case if message is not written to vsam (due to some error) i will miss the record as it is not available in Q any more. |
Not if you use syncpointing.
bijal.awhad wrote: |
How should i do this? I am new to MQ. If i get sample code that will be great help..
|
You should read the Application Programmer's Guide.
You'll find sample code included with your WMQ installation, and also by following the link at the top of this page. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bijal.awhad |
Posted: Mon Dec 08, 2008 1:57 am Post subject: You should read the Application Programmer's Guide |
|
|
Newbie
Joined: 08 Dec 2008 Posts: 3
|
Do you have any link for this ? |
|
Back to top |
|
 |
exerk |
Posted: Mon Dec 08, 2008 2:45 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Vitor wrote: |
You'll find sample code included with your WMQ installation, and also by following the link at the top of this page. |
_________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 08, 2008 2:59 am Post subject: Re: You should read the Application Programmer's Guide |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bijal.awhad wrote: |
Do you have any link for this ? |
Look up - you'll see links for sample code and the documentation.
You'll also find both on the web, and included with your installation. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Mon Dec 08, 2008 3:14 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
MQGMO_SYNCPOINT on the MQGET
then MQCMIT after the successful VSAM write.
However you should inspect the message backout count to prevent a loop. |
|
Back to top |
|
 |
bruce2359 |
Posted: Mon Dec 08, 2008 6:24 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
VSAM is single-phase comit by default. You will need to look at implementing transactional VSAM (CICSTVS) to be able to comit/backout mq gets/puts with VSAM activity. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
zpat |
Posted: Tue Jan 27, 2009 12:43 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Transactional VSAM.....who would have thought it! |
|
Back to top |
|
 |
|