Question
Stuart Strickland · Sep 9

$ZNAME(variable,0)

This function is supposed to tell me that argument 1 is a valid variable name or not.

Doesn't work with an array variable, eg W $ZNAME("WLCOM(I)",0).

Not a question, just a whinge really.....

Product version: Caché 2017.1
$ZV: Cache for Windows 2017.2.2
00
3 0 3 115
Log in or sign up to continue

Got round it with $ZNAME($p(Variable,"("),0)

I guess there is a danger that someone else might be checking if WLCOM(I) in its full stringy form is a valid variable name. Arguably it should fail in the same way WLCOM/I/ should.

Instead of using the first piece with $PIECE(variable,"("), I recommend using $NAME(@variable,0). $NAME has the advantage that it will likely be updated in the event of any changes to introduce new variable syntax, while $PIECE(variable,"(") will remain stuck with the simple syntax. One advantage of $NAME(@varaible,0) is that $NAME will also check the syntax of all the subscripts. One disadvantage is that all subscripts must be defined.