You can control the order in which patterns are compared against each message by assigning a pattern PRIORITY of 0 to 255. The lower the number, the higher the priority. AMS compares messages to patterns with lower numbers before patterns with higher numbers.
For standard patterns, AMS uses the priority to determine the search order for patterns that share a keyword in the same token position. If a message matches patterns with different keywords, the priority has no effect. In this situation, the search order is unpredictable. Note that this is a different situation than described in the following paragraph.
AMS searches standard patterns without keywords and nonstandard patterns strictly in order of priority. If two or more of these patterns are given the same PRIORITY value, the search order is unpredictable.
Format
PRIORITY integer
where integer is the priority associated with the pattern, from 0 (highest priority) to 255 (lowest priority). The default value is 128.
SP-AMS Examples
The following messages are part of the output from the UNIX command df -v:
/ /dev/root 400816 320296 80520 79% / /dev/root 400816 360735 40081 90%
The following patterns illustrate how these messages would be matched based on the priorities defined in the patterns:
DEFINE "group1" 1 MESSAGE "/ /dev/root blocks used free 9\?1\%" PRIORITY 120 TOKEN KEYWORD 2 "/dev/root" TOKEN MASKED 6 "9\?1\%" . . . DEFINE "group1" 2 MESSAGE "/ /dev/root blocks used free used%" TOKEN KEYWORD 2 "/dev/root"
From this example, we can determine the following:
Both patterns use the same keyword (/dev/root) as the second token.
The first pattern uses the masked token 9\?1\% for the sixth token. This matches 90%, 91%,..., 99%.The second pattern does not specify a sixth token.
The first message can match only the second pattern.
The second message can match either pattern. The priority of the patterns determines which one matches the message. In this case, the first pattern has a priority of 120, which is higher than the priority of the second pattern, which is the default of 128.These priorities cause the message to match the first pattern.
The next example defines a test pattern and also assigns it the next pattern number in group group2. The pattern is given the lowest priority of 255, so it is searched last.
DEFINE "group2" MESSAGE "THIS IS A USER MESSAGE" TYPE TEST PRIORITY 255
CP-AMS Examples
Assume the following two OS 2200 console messages:
BKG ERROR FIN CMS ERROR FIN
The following patterns illustrate usage of the PRIORITY command:
DEFINE "group1" 1 MESSAGE "CMS ERROR FIN" TYPE PRIVILEGED-EXEC PRIORITYM 120 TOKEN KEYWORD 2 "ERROR" TOKEN MASKEDM 1 "CMS\*3\" END DEFINE "group1" 2 MESSAGE "run-id ERROR FIN" TYPE PRIVILEGED-EXEC TOKEN KEYWORD 2 "ERROR" END
From this example, we can determine the following:
Both patterns are of the same type (PRIVILEGED-EXEC).
Both patterns use the same keyword (ERROR) as the second token.
The first pattern uses the masked token CMS\*3\ for the first token, and the second pattern specifies nothing for the first token (and is therefore a more general pattern).
The message BKG ERROR FIN could match only the second pattern. There is no ambiguity for this message.
The message CMS ERROR FIN could match either pattern. The search order is now important and the first pattern should be assigned a higher priority to ensure AMS finds it first.
The priority of the first pattern is 120, so it is searched before the second pattern whose priority is the default of 128.
Note: Since the Exec sends "ERROR FIN" messages, you could not specify "CMS\*3\" as a RUNID token (see 2.10). Although BKG and CMS are run-ids, you cannot use a run-id token to match them. Here they are part of the normal message text and so can be matched only using a keyword, fixed, or masked token. Remember that the RUNID token is used to match the generated run-id attribute of a console message. For Exec messages, this attribute is blank. For privileged and nonprivileged messages, this generated run-id and the following asterisk are stripped off by AMS.