using external attributes in AlarmNotifier scripts no longer works after upgrade to CA Spectrum 10.3

Document ID : KB000121243
Last Modified Date : 03/03/2019
Show Technical Document Details
Introduction:
Using the 0x12B4C attribute "dynamic" alarm title in notifier script does not work after upgrade spectrum from 10.2.1 to 10.3.1. 
Background:
In our Spectrum 10.3 docops, we document

“Windows automatically sets environment variables to uppercase. Therefore, when you reference these variables, use the uppercase format, such as $SANM_0X100C5.

https://docops.ca.com/ca-spectrum/10-3-0/en/managing-client-applications/alarmnotifier/customizing-alarmnotifier/passing-ca-spectrum-attributes-to-scripts/

     Passing CA Spectrum Attributes to Scripts

     Global Alarm Attributes
   
 Attributes of a model with an alarm can be passed to AlarmNotifier. Model attributes can be used as parameters in SetScript, ClearScript, or UpdateScript. Use the .alarmrc parameters EXTRA_ATTRS_AS_ENVVARS or EXTRA_ATTRS_AS_ARGS to pass in attributes. To enable these parameters, set the USE_NEW_INTERFACE .alarmrc parameter to TRUE.

     EXTRA_ATTRS_AS_ENVVARS passes attributes to AlarmNotifier as environment variables. EXTRA_ATTRS_AS_ARGS passes attributes as command-line arguments. For most attributes, either of these mechanisms can be used. However,  EXTRA_ATTRS_AS_ENVVARS is required in cases where new lines or special characters can cause problems for the script that parses the extra data. When USE_NEW_INTERFACE=TRUE, the environment variable mechanism is used to pass $STATUS, $EVENTMSG, and $PCAUSE to avoid this problem.

     In the .alarmrc file, set the appropriate parameter equal to the CA Spectrum attribute IDs that you want to pass. You can reference the attribute ID either in hexadecimal or decimal notation.

     If you pass an attribute as an environment variable using EXTRA_ATTRS_AS_ENVVARS, you reference this variable in a script using the following syntax:

     $SANM_<attribute_ID>
 
Where <attribute_ID> specifies the attribute ID of the attribute you are referencing. If you have used hexadecimal notation to call this attribute in the .alarmrc file, hexadecimal notation is also required in the script. If you have used decimal notation to call this attribute in the .alarmrc file, use decimal notation in the script.

This is also seen in the setScript on Spectrum installations.

     Note: Windows will uppercase these variables, so they need to be referenced
     #        that way - ie. $SANM_0X100C5 and $SANM_0X11F84.


 
Environment:
CA Spectrum 10.3, Alarm Notifier using dynamic alarm titles.

 
Instructions:
We document
“Windows automatically sets environment variables to uppercase. Therefore, when you reference these variables, use the uppercase format, such as $SANM_0X100C5.”
However, this behavior has changed in 10.3 and can be seen by adding the following echo commands in setScript of both 10.2 and 10.3 labs.
 
echo "The value of attribute SANM_0X12B4C is: " $SANM_0X12B4C
echo "The value of attribute sanm_0x12b4c is: " $sanm_0x12b4c
echo "The value of attribute SANM_0x12b4c is: " $SANM_0x12b4c

We get the following output

In Spectrum release 10.2.x:
The value of attribute SANM_0X12B4C is:  this is a dynamic alarm
The value of attribute sanm_0x12b4c is:
The value of attribute SANM_0x12b4c is:

In Spectrum release 10.3.x:
The value of attribute SANM_0X12B4C is:
The value of attribute sanm_0x12b4c is:
The value of attribute SANM_0x12b4c is:  this is a dynamic alarm

We can see that how attributes are read on Windows, changes from 10.2 to 10.3, in scripts. Anyone using external variables in AlarmNotifier will need to change their scripts to reflect the above changes. So, for Spectrum 10.3, whatever case we use in .alarrmrc file should be used in SET script too. For example: If we use, 

EXTRA_ATTRS_AS_ENVVARS=0x12B4C 

Then we have to use SANM_0x12B4C in SET script too. 

In 10.3.1, we will include code changes to convert the AlarmNotifier environment variables to uppercase for Windows. 

 
Additional Information:
Cygwin now does not change the case of environment variables, except for a restricted set to maintain minimal backward compatibility. 
There was a setting CYGWIN=upcaseenv, to switch back to older behavior. But, this has been removed from 1.7.10 version.
You can check the following links for reference: 
Changes to Cygwin and here

Passing CA Spectrum Attributes to Scripts

https://comm.support.ca.com/kb/set-up-dynamic-alarm-titles/kb000121244