Program with subroutines for machining process