Program main
USE MPI
IMPLICIT NONE
INTEGER*4 ierr,rank,size
INTEGER answ
WRITE(6,3) 
3 FORMAT('START')
CALL MPI_INIT(ierr)
CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
IF(rank.EQ.0)WRITE(6,1)
1 FORMAT('HELLO')
READ(5,2)answ
2 FORMAT(I4)  
CALL sub()
CALL MPI_FINALIZE(ierr)
STOP
END
SUBROUTINE sub() !These MPI-lines caused a breakpoint error
!Subroutine to read parameters from file rank after rank    
IMPLICIT NONE; INCLUDE 'mpif.h'
!---------------------------------------------------------------------------------------
INTEGER rank,rankread,size
INTEGER*4 ierr,status
!---------------------------------------------------------------------------------------
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
CALL MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
rankread=0
IF(rank.EQ.0)THEN; rankread=1; ELSE;
  CALL MPI_RECV(rankread,1,MPI_INTEGER4,rank-1,1,MPI_COMM_WORLD,status,ierr)
ENDIF
!-------------------------------------------------------------------------------------
IF(rankread.EQ.1)THEN
  !Read parameters from file
ENDIF
!-------------------------------------------------------------------------------------
IF(rank.LT.size-1)THEN
  CALL MPI_SEND(rankread,1,MPI_INTEGER4,rank+1,1,MPI_COMM_WORLD,ierr)
ENDIF
!---------------------------------------------------------------------------------------
RETURN
END    