Michael_Lowry

:SET_SCRIPT_VAR — changed behavior between v9 and v11

Discussion created by Michael_Lowry on May 27, 2016
Latest reply on Oct 9, 2017 by Michael_Lowry
We upgraded one of our systems from v9sp11 to v11.2.1.1 recently, and observed a change in the behavior of :SET_SCRIPT_VAR between the two versions. The following script works differently in v11 than in v9.

UC0.MAL.INDIRECT_REFERENCE.SCRI

:SET &VAR_12# = ""
:SET &name_part1# = "VAR_"
:SET &num# = 12
:SET &name_part2# = FORMAT(&num#,"00")
! :SET &var_name# = "&"
:SET &var_name# = STR_CAT(&var_name#,&name_part1#)
:SET &var_name# = STR_CAT(&var_name#,&name_part2#)
! :SET &var_name# = STR_CAT(&var_name#,"#")
:SET &value# = "ABC"
:SET_SCRIPT_VAR &var_name# = &value#
:SET &temp# = GET_SCRIPT_VAR(&var_name#)
:PRINT "Constructed variable name                 : &var_name#"
:PRINT "Value from :SET_SCRIPT_VAR/GET_SCRIPT_VAR : &temp#"
:PRint "Value retrieved directly from variable    : &VAR_12#"

v9 output

2016-05-27 11:42:43 - U0020408 Constructed variable name                 : &VAR_12#
2016-05-27 11:42:43 - U0020408 Value from :SET_SCRIPT_VAR/GET_SCRIPT_VAR : ABC
2016-05-27 11:42:43 - U0020408 Value retrieved directly from variable    : ABC

v11.2 output

2016-05-27 11:41:59 - U00020408 Constructed variable name                 : &VAR_12#
2016-05-27 11:41:59 - U00020408 Value from :SET_SCRIPT_VAR/GET_SCRIPT_VAR :
2016-05-27 11:41:59 - U00020408 Value retrieved directly from variable    :
It seems that the :SET_SCRIPT_VAR command on line 10 is not setting the value of the variable &VAR_12#. Note too that in v11.2, lines 5 and 8 must be uncommented before the script will even run. If these lines are commented out, the script runs fine in v9, but will not even start in v11.2. The following error message appears:
5/27/2016 11:44:16 -  U01001350 Variable 'VAR_12' not found.
I assume that this means the leading & and trailing # must now be explicitly put into the value of the variable whose name is passed to :SET_SCRIPT_VAR. However, although this change allows us to get past the error, :SET_SCRIPT_VAR still does not work as expected.

Have anyone had success using :SET_SCRIPT_VAR in v11.2? If so, would you be willing to share an example of how you use it?

Outcomes