Code:
! A Program for testing sorting algorithms
! Filename: sort.f90 Src: JWW 10/2007
  USE SORTMOD
  Implicit NONE
  integer, parameter :: n=80
  integer :: i
  real :: A(n)

  call random_number( A )

  call InsertionSort( A, n )

  do i=1,n
    print *,i,A(i)
  end do
end Program Sort

Code:
MODULE SORTMOD
  IMPLICIT NONE
CONTAINS

  SUBROUTINE InsertionSort(B, m)
    REAL, dimension(:) :: B !Dummy variable
    INTEGER :: m
    INTEGER :: i, j
    REAL :: key

m=80

    do j = 2, m
       key = B(j)
       i = (j - 1)
       
       do
          if ((i>0) .AND. (B(i) > key)) exit
          B(i+1) = B(i)
          i = (i - 1)         
       enddo
    
       B(i + 1) = key
    enddo


  END SUBROUTINE InsertionSort
END MODULE SORTMOD

Hey, The first part of code is the main program that was given to us that will genertate an array of random numbers. It calls the module to perform insertion sort. The second part is that module which I wrote. Everything compiles fine, but the program does nothing when run. It just gives me a cursor to type anything in (perhaps an infinite loop?) I really can't see where I went wrong here. Any tips?