GET_PUBLISHED_VALUE passes NULL as space when value of variable (&VAR#) it is accessing has null string

Document ID : KB000088332
Last Modified Date : 14/04/2018
Show Technical Document Details
The function GET_PUBLISHED_VALUE is passing a NULL as a space when the value of the variable (&VAR#) it is accessing has a null string.

As a consequence, the IF statement in the following script may evaluate &VAR# as True when comparing it to an empty string('').


:IF &VAR# = ' '
: PRINT "The value is NULL"
: PRINT "The value is NOT null"

OS: All
This is by design.

The GET_PUBLISHED_VALUE correctly transmits the variable &VAR# as Null String.

In fact, the variable &VAR# has the value "". The comparison :IF &VAR# = ' ' is evaluated as TRUE because the trailing blank spaces are not considered in string comparisons.

The following is an excerpt from the documentation:  "Trailing blank spaces are not considered in string comparisons. Therefore, blank strings always are equal independent on their length."

If you would like to check for NULL String Values, do not use a check with IF.  Check or compare with an intermediate STR_MATCH. The STR_MATCH makes a genuine string compare, and "" and " " will not be marked as equal. 

For example:
:IF &MATCH# = 'Y' 
 : PRINT "The value is NULL" 
: PRINT "The value is NOT NULL"