The command file MQTRIGGER.COM is supplied with MQSeries for Compaq OpenVMS Alpha as an example of a command file designed to take the parameters supplied by the trigger monitor (RUNMQTRM) and separate the fields in the MQTMC2 structure.
The command file expects the first parameter to be the image, or command file, to invoke with selected fields from the MQTMC2 structure.
MQTRIGGER passes the following fields from the MQTMC2 structure to the
invoked image or command file:
Parameter | MQTMC2 Field |
---|---|
1 | QName |
2 | ProcessName |
3 | TriggerData |
4 | ApplType |
5 | UserData |
6 | QMgrName |
The ApplicId field of the trigger process definition is specified as follows:
APPLICID('@mqs_examples:mqtrigger $mqbin:amqsech')
This example assumes that the MQBIN logical directory has been defined as:
SYS$SYSROOT:[SYSHLP.EXAMPLES.MQSERIES.BIN]
The ApplicId field of the trigger process definition is specified as follows:
APPLICID('@mqs_examples:mqtrigger @dka200:[user]cmd')
Applications triggered by MQSeries for Compaq NonStop Kernel receive user data through environment variables set up in the TACL process that is running. This is because there is a limit to the length of the argument list that can be passed to a C process running under Compaq NonStop Kernel.
In order to access this information, triggered applications should contain code similar to the following (see the supplied sample amqsinqa for more details):
MQTMC2 *trig; /* trigger message structure */ MQTMC2 trigdata; /* trigger message structure */ char *applId; char *envData; char *usrData; char *qmName; /******************************************************************/ /* */ /* Set the program argument into the trigger message */ /* */ /******************************************************************/ trig = (MQTMC2*)argv[1]; /* -> trigger message */ /* get the environment variables and load the rest of the trigger */ memcpy(&trigdata, trig, sizeof(trigdata)); memset(trigdata.ApplId, ' ', sizeof(trigdata.ApplId)); memset(trigdata.EnvData, ' ', sizeof(trigdata.EnvData)); memset(trigdata.UserData, ' ', sizeof(trigdata.UserData)); memset(trigdata.QMgrName, ' ', sizeof(trigdata.QMgrName)); if( (applId = getenv("TRIGAPPLID")) != 0) { strncpy( trigdata.ApplId ,applId, strlen(applId) ); } if ( (envData = getenv("TRIGENVDATA")) != 0) { strncpy( trigdata.EnvData , envData, strlen(envData) ); } if ( (usrData = getenv("TRIGUSERDATA")) != 0) { strncpy( trigdata.UserData, usrData, strlen(usrData) ); } if ( (qmName = getenv("TRIGQMGRNAME")) != 0) { strncpy( trigdata.QMgrName, qmName, strlen(qmName) ); } trig = &trigdata;