I've never used the @homeshr macro so I can't say if this is expected or not, but the following might help.

untested
 Code:
if exist(@homeshr + "\" + @userid)
  use g: @homeshr + "\" + @userid
else
  use g: @homeshr
endif