Save data (such as contact force) during MoveJ and FCPressL

I am trying to save data to a file during the movement of the robot under position/force control (i.e. MoveJ or FCPressL).

I could save the data (contact force) to a file while the stop of the robot, but during the movment, I could not!

Can you help me on this.

The code data saving is as follows:


Open FileLocation, File \Append;

MoveJ pos2,v20,fine,tdDemo\WObj:=wobj0;

WHILE j<=1000 DO
WaitTime 0.01;
fcForceReading:=FCGetForce(\ContactForce);
RecordFz{j}:=fcForceReading.zforce;

Write File, NumToStr(RecordFz{j},1)+", ";
j:= j+1;
ENDWHILE

Best regards,
Abd El Khalick