Thursday, March 3, 2011

Basic UNIX Commands

If you want UNIX Commands

Click heregnarayanareddy.blogspot.com

Channel status


dis clusqmgr(*) - which displays all the queue manager which are in the cluster
 
dis qcluster(*) - displays all the queues which are in cluster. 

Display channel status
Display  chstatus (channel_name)   ALL
Check  if there are any messages in the transmission queue
Dis    chl(*) xmitq
dis  q(xmitq_name)   curdepth
only sender channel display
dis   chl(*)     Chltype(sdr)
dis   chl(chl_name)   all
dis   chl(*)   type(sdr)   all
which channel   is supposed to be processing the transmission queue    qm2
dis   channel (*)  where (xmitq  eq qm2)
Are the messages on the queue available
display   qstatus(Qname)  type(queue)  all
check t whether the putting application is committing the MESSAGES  CORRECTLY.
DISPLAY     QSTATUS(Qname)   TYPE(HANDLE)    OPENTYPE(OUTPUT)
WHAT ABOUT WHEN THE CURRENT DEPTH IS NOT INCREASING?
THE WHETHER  YOUR APPLICATIOPN IS PROCESSING MESSAGES CORRECTLY.QUEUE  TO CHECK
DISPLAY QSTATUS(QNAME)  TYPE(QUEUE)   MSGAGE   QTIME


s SYSTEM.DEF.SVRCONN the only channel you have defined, and are using? Any other channels? 



What do you get when you do a DIS CHS(*) command?


echo 'dis chs(ChlName) all' |runmqsc <QmgrName> | grep 8417 | wc -l 


this will list the count of no. of connection instances on that channel. 



AIX: lslpp -L all 


SOLARIS: pkginfo 



LINUX (the one I'm using): rpm -qa|grep MQSeries 


To determine MQ Version and Current CSD Level: 



In Sun Solaris and HP-UX this info is in a file called: 


/opt/mqm/READMES/en_US/memo.ptf 




In NT Platform, this info is in a file called: 


C:\\WIN32APP\MQSeries\UK_5\memo.ptf


 AIX: 



/usr/lpp/mqm/READMES/En_US/memo.ptf

The mqver command works on both AIX and NT/2000 systems 

DIS QMGR ALL - look at the CMDLEVEL to determine MQ version or use SMPE and check the FMID HMS5300 is v 5.3 



Since CSD's aren't released for z/OS, you have to use SMP/E to determine the last PTF you have applied.


As well as using mqver / dspmqver, DIS QMGR CMDLEVEL, and looking at the memo.ptf file, the MQ version and fix update level on Unix platforms can also be determined using the relevant software installation / packaging tools. eg. 



Solaris: 


pkginfo | grep mqm 


pkginfo -l mqm 

pkginfo -l mqm-upd14 




HP-UX: 


/usr/sbin/swlist | grep MQ 



Linux on Intel and zSeries: 

rpm -q -a | grep MQ 




AIX: 


lslpp -l | grep mqm 



http://www.mqseries.net/phpBB2/images/smiles/icon_rolleyes.gif 

Well there isn't one, once you type runmqsc there is no command recall and the only editing option you have is the backspace and arrow keys but for the people running MQSeries on UNIX and to a certain extent DOS there are ways to issue MQSC commands and have command line editing and command recall. 




On Unix platforms simply set your shell to ksh and set your editor to vi as in 


# ksh 


# set -o vi 




Then use the following syntax: 




# echo "dis ql (*) curdepth" | runmqsc QMGR01 




Then if you want the output sent to a file: 




# echo "dis ql (*) curdepth" | runmqsc QMGR01 > /tmp/disqlout 


> will clobber an existing file with the new output 


>> will abend to the end of an existing file 




This allows you to use vi, view, more or cat to see the contents of the file file or save the output for later use. 




If you don't recall the exact name of specific QL and you know a unique portion of the name of the object then: 




# echo "dis ql (*)" | runmqsc QMGR01 | grep STRING 




(note you can use this syntax in DOS to but don't use the quotes) 


(note this will also allow you to imbed MQSC command in simple shell scripts) 




If you want to know the number of running channels on QMGR01 then do this: 




# echo "dis chs (*)" | runmqsc QMGR01 | grep -v grep | grep RUNNING | wc -l 




(note do not use the "all" argument in the dis chs when running this or you will get a line count for all the MCASTAT instances of RUNNING doubling you total) 




In Unix you can use Esc-k to recall the most recent command and edit it. 


(note Esc-k is reading the .sh_history file) 




Continue hitting k to move farther backward in the command history. You can use j to move forward. 




(note in DOS us the up arrow to move backward and the down arrow to move forward in the command history but this only works in an existing DOS Command Window instance) 




You can edit the command lines using normal vi commands like l to move left, h to move right, i to insert text etc. 




(note in DOS use your arrow keys, delete and backspace and when typing changes keep in mind that you are alway in insert mode) 




Also in Unix if you want to search your history hit Esc-K then / and type the string you are looking for. For example 




# /ql 




will find the most recent ql in you .sh_history. Then you can type n to get to the next instance of ql in your .sh_history. 




I suppose if you wanted to use another Unix editor like Emacs you could but I prefer vi because it is included in almost if not all flavors of Unix. 




Also, this works for regular Unix commands aswell. For example if you type 




# ps -ef | gerp -v grep | grep mqm | wc -l > mqmproc.out 




you will get an error "gerp not found" 




Hit Esc-K, use the l to move left until the cursor is on the e in gerp and type xp. xp will switch the position of the e and the r so that gerp is grep then hit Enter. 




When I was first exposed to these little tricks I didn't give them much credence. Then after time I started using them more and more often. Now I can't imagine not using them. 




What is the curdepth now? How about now? Now? OK fine... 




# while true 


# do 


# echo "dis ql(SYSTEM.DEAD.LETTER.QUEUE) CURDEPTH" | runmqsc MQMGR 

# echo "dis ql(APP.QUEUE) CURDEPTH" | runmqsc MQMGR 

# sleep 15 

# clear 



# done