Connect motion statements to variables.

I want to control motion states in a robot program with variables.
To be precise: I want to change the Z coordinates in PTP or LIN statement.
This change will be controlled by assigning a variable.

Any ideas on how to do this?