In a recent update to MQSCX, two new features were introduced which allow you to discover the Command Level and Platform of the queue manager that the script is currently connected to.
The Command Level feature is aptly demonstrated by a new example script, mqauthlist.mqsx, available in our Example Scripts bundle. This script uses the DISPLAY AUTHREC command to interrogate the queue manager for the current authorisation settings for the queue manager. This command is only available at a command level of 710 or above, and the script utilises a new MQSCX system variable, _cmdlevel to check for this before attempting to issue any such commands. Here’s how:-
** QMgr must be at command level 710 or greater to use this script. if( _cmdlevel < 710 ) fprint @hf,"QMgr does not support authorization record queries." fprint @hf,"Command Level must be 710 or greater.",_nl continue endif
Although not illustrated in this script, the other new MQSCX system variable which goes hand-in-hand with _cmdlevel is _platform which allows you to check the platform of the queue manager is as expected before doing something in a script that is dependent on a particular platform.
The values of _cmdlevel and _platform are the same values that you would see if you issued the MQSC command:-
DISPLAY QMGR CMDLEVEL PLATFORM
when the script is connected to a queue manager, and -1 and NOTCONNECTED respectively when the script is not connected to a queue manager.
The best way to understand scripts is of course to have a go with them yourself. There are various examples in the download, so why not try them out yourself. If you are not currently an MQSCX licence holder, you may email firstname.lastname@example.org to request a trial licence.