The program slicing technique is employed to calculate the current values of the variables at some interest points in software test data generation. This paper introduces the concept of statement domination to represent the multiple nests, and presents a dynamic program slice algorithm based on forward analysis to generate dynamic slices. In the approach, more attention is given to the statement itself or its domination node, so computing program slices is more easy and accurate, especially for those programs with multiple nests. In addition, a case study is discussed to illustrate our algorithm. Experimental results show that the slicing technique can be used in software test data generation to enhance the effectiveness.