How to know when the moveJ command has finished operation

How to know when the movej command has finished the operation
Also, how does the mapping for robot_mode occurs?