Forcing hierarchical nodes through tasks

In reply to sharvil111:

In reply to sohil08:
Did you tried using ref as input argument of task.

task check(ref logic a,b,c);
force a = 0;
force b = 1;
force c = 0;
endtask
// calling task
for (i=0;i<=n;i++)
begin check(RTL_HIER.a[i],RTL_HIER.b[i],RTL_HIER.c[i]);
end

It is giving below error :
Dynamic type in non-procedural context
“force a = 'b1;”
Argument: a
Automatic variable may not be used in non-procedural context.