The way that I use Is Empty(), is to see if a variable has ever been assigned. Thus avoiding a syntax error for:
names default to here(1);
show(z);
one can check to see if the variable "z" has ever been referenced:
Names Default To Here( 1 );
If( Is Empty( z ) == 0,
Show( z )
);
A better example is the one below.
Names Default To Here( 1 );
x=1;
If( x > 2, z = 7 );
If( Is Empty( z ) == 0,
Show( z )
);
Since JSL is an interpreted language, it follows the logic flow of the JSL So, if x <= 2, JSL will not execute (not even look at) z = 7, and therefore without the checking to see if z Is Empty() is required since JSL would give a syntax error.
In your example, you are using a different form of assigning the value to z
names default to here(1);
z=(if(1>2, 7));
show(z);
The variable z will take on the value of 7 if 1>2, but if not true, z is no longer not assigned, so it will take on a missing value, ".". The advantage here, is that once the assignment is made, JSL has processed the variable z and will not have a syntax error if z is referenced later in the program flow.
This brings us to the question of should one assign Empty() as the result of a false being returned in an If() function.
names default to here(1);
z=(if(1>2, 7, Empty()));
show(z);
It then simply comes down to, do you not want to have z as a missing value and would rather check for Is Empty() vs. Is Missing(). I personally prefer the missing value route, since it leaves Empty() as a verification that z has never been assigned. .
Jim