A recursive routine is a routine that calls itself. Recursion is the most natural method of solving certain problems, such as:

- Searching a tree
- Calculating certain mathematical functions
- Following paths through a network
- Processing a bill of materials
- Choosing the best solution from a set of possible solutions

Although you can write any recursive routine as a straight iterative routine, the use of a recursive routine can simplify the program's logic.

In this COBOL system, a program can be recursive provided it is not nested inside another program and it has a Local-Storage Section. A program can call itself via either its program-id or an entry point.

Each call of a recursive routine is called an instance. Each instance needs a different set of the data items used by the routine; so this COBOL system enables you to have a Local-Storage Section. A run-time error message is issued if you try to use recursion in a program that does not contain a Local-Storage Section.

See Related information for examples of recursion and recursive routines.