compare robot axis value

Is there a way to check individual axis angle? I like to check robot axis 2 angle before moving robot into another position

VAR jointtarget pCurrentRobt;

pCurrentRobt := CJointT();

this is where I am stuck

IF axis 2 is greater than 90 degree, don’t move robot

Nevermind, I found it

IF pCurrent.robax.rax_2 > 90 Stop;