A set of computer instructions (or pieces of code) that run within a program (or are called within a program) to carry out a predefined function or computation. Note: “Open” subroutines are integrated into the main program. “Closed” subroutines are arranged so that program control is shifted to them for execution of their task(s) and then returned to the main program.