Havent done this myself, but here are a few suggstions.
if you are using MQ client, you could use client channel table.
if you are using MQ server, then here are some of the options.
1) In your app, issue a system command and call MQ command DSPMQ which displays a list of queue managers on the local machine. Copy this into either a local buffer or a file and parse the qm name from it.
2) Similarly call saveqmgr from your system command and repeat the same process as in step 1 to get all the local queues.
Good luck.
Cheers
KK