MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Selective read from a MQ

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
Dip
Beginner


Joined: 24 Mar 2006
Posts: 27
Topics: 14

PostPosted: Thu Jun 14, 2007 9:05 pm    Post subject: Selective read from a MQ Reply with quote

Hi,

Can i read (COBOL-MQ program) messages selectively from a MQ?

Let say i have 5 messages in a MQ

AAAAA--------------$$------Record---------1
ABABA--------------AN------Record---------2
ABABA--------------AA------Record----------3
ABABX--------------$$------Record----------4
AXCSV--------------SA------Record---------5

I want to read and write messages 1 and 4($$ is the identifier) into a flat file from the MQ and leave the messages 2, 3 and 5 back in the MQ.

Thanks!
Dip.
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jun 15, 2007 6:35 am    Post subject: Reply with quote

Dip,

Did you get a chance to look at this post?

http://www.mvsforums.com/helpboards/viewtopic.php?t=8059&highlight=MA1M

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jun 15, 2007 6:36 am    Post subject: Reply with quote

if the messages are indexed, yes. Indexing for the queue must be ON, because that affects the original PUT.

If they are not indexed, best you can do is do a destructive read, write to qsam what you want and those that you don't want rewrite to the queue. Before you start the process, you need to know how many items are on the queue, and just perform the read/write cycle that many times. But if the queue is constantly being PUTed by another source, you are going to have to identify and save the first queue item that you PUT so that when you GET it again, you know to stop. This means commit every get.

another way is to use the MQS management utility and copy all items to a work queue and process that queue with your program.

DFSORT canl browse the queue, you can access the items you want, but they all will stay on the queue.

If this is a production requirement, that different msgs are processed by different subsystems, your queue design is very poor.

You could improve the present queue structure design by writting a module that does destructive reads on the current catch-all queue and redistributes msgs based on criteria to 'new' queues which can be read destructively by their appropriate sub-system - thus you would not have to endure the silliness that the original design has provided.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
bob_buxton
Beginner


Joined: 20 Dec 2002
Posts: 44
Topics: 0
Location: Hampshire, England

PostPosted: Fri Jun 15, 2007 7:21 am    Post subject: Reply with quote

If you can arrange to have your selection field into Correlid or Groupid fields of the MQMD header when the messages are put you can then get messages by Correlid/Groupid.

If that is not feasible you can Browse the queue and then do a get with MQGMO_GET_MESSAGE_UNDER_CURSOR to remove messages of interest from the queue
_________________
Bob Buxton
Ex Websphere MQ for zOS development
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jun 15, 2007 7:27 am    Post subject: Reply with quote

bob_buxton,
great post, thx.

when did MQGMO_GET_MESSAGE_UNDER_CURSOR become effective?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri Jun 15, 2007 8:53 am    Post subject: Reply with quote

dbz wrote:
when did MQGMO_GET_MESSAGE_UNDER_CURSOR become effective?

it's been around for a while. never used it, thus was ignorant.

Dip,

if this is a one time thing, or it is not feaseible to modify the MQPUTs Correlid/Groupid,
then you will have to use the MQGMO_GET_MESSAGE_UNDER_CURSOR route.

following links will explain:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/FRAMESET/AMQA3003/CCONTENTS?DT=19960522122911
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/FRAMESET/AMQA3003/CCONTENTS?DT=19960522122911
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group