interrupt loop while receiving data

I'd like to stop the main program in order to receive the next command.

To pause the program waiting for input, you could use

 while (Serial.available() <= 0) {}

What you do when you break from the while loop after waiting for serial input depends on what is being sent.