there are standard parameters which allow you to name any axis with a letter in the range X Y Z A B C U V W. on the 31 series this parameter is 1020 but also check the other axis parameters (1000 to 1031)
when you say lock do you mean clamping a rotary axis? there is usually an M code for that for A B C axis.
you should probably start by naming the axes to a more standard layout XYZ for sliding movement and ABC for rotary movement. an M code to clamp an axis is usually specific to the machine and would likely be part of the PMC/Ladder and done by the machine tool builder (MTB)