I am reading messages from one queue and putting all the messages in another queue.
For this I opened the queue two time one is in input mode and other is in output mode.
This is contradictory. If you're reading (getting) from one queue and putting (writing) to another queue, you have 2 queues in use. You need to MQOPEN and MQCLOSE each queue.
Also, if your application were to MQGET from a queue and then MQPUT(1) to the same queue, you'd never, ever, empty the queue. If your application is triggered or using triggering, then you're in trouble.
Garry you understand my requirement. But you need to clarify one thing i.e.
Before opening the queue we are passing Queue name for example
MOVE que-name TO MQOD-objectname
COMPUTE MQM-OPTIONS = MQOO-OUTPUT
CALL 'MQOPEN' USING MQM-CONNECTION-HANDLE.............
Here my question is before closing the Queue I need to move Queue name to to MQOO-OBJCTNAME. Because we have opened two QUEUE and also we need close the Queue two times then each time during the Clsoe tiem shall I need to mention Queue name like in case of MQopen.