MQSCX feature – Machine O/S

In a recent update to MQSCX, a new feature was introduced which allows you to discover the machine OS that the script is running on.

This feature is aptly demonstrated by a new example script, mqauthlist.mqsx, available in our Example Scripts bundle. This script writes a report, and the file location of the output report needs to vary depending on whether the script is run on a Windows machine or on a Unix machine. So the script utilises a new MQSCX system variable, _os to determine where MQSCX is running, and thus the report location. Here’s how:-

** Set the output file path location based on the os type
if( _os = "WINDOWS" )
   @outputpath = "C:\MQSCX\Output\MQAuthlist\"
else
   @outputpath = "/var/mqscx/output/mqauthlist/"
endif

The @outputpath variable is then later used to build the file name that is opened to write the report to.

** Open file and write header
@filename = @outputpath + "mqauthlist_" + date(_time, "_y_mm_d") + ".txt"

@hf = fopen(@filename, "w")

Server O/S

The possible values of _os are:-

  • AIX
  • LINUX
  • PLINUX
  • WINDOWS

Clearly a lot of examples that come to mind will be the Windows vs not Windows decision as is illustrated in this script (and also in our fnamelist.mqx script in the bundle), but there may also be times when specific Unix based decisions might also be useful.


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 support@mqgem.com to request a trial licence.

Advertisements

The team at MQGem would love to hear what you think. Leave your comments here.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s