We study the Weyl closure Cl(L) = K(x)[partial derivative]L boolean AND D f
or an operator L of the first Weyl algebra D = K[x, partial derivative]. We
give an algorithm to compute Cl(L) and we describe its initial ideal under
the order filtration. Our main application is an algorithm for constructin
g a Jordan-Holder series for a holonomic D-module and a formula for its len
gth. Using the closure, we also reproduce a result of Strombeck (1978), who
described the initial ideals of left ideals of D under the order filtratio
n, and a result of Cannings and Holland (1994), who described the isomorphi
sm classes of right ideals of D. (C) 2000 Academic Press.