      program example26b_master
      include 'mpif.h'
      integer size, rank1, rank2, ierr
      integer status(MPI_STATUS_SIZE), intercomm
      character*10 slave
      slave="./slave"
      call MPI_INIT(ierr)
      call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierr)
      call MPI_COMM_SPAWN(slave, MPI_ARGV_NULL, 2,
     &                    MPI_INFO_NULL, 0, MPI_COMM_SELF,
     &                    intercomm, MPI_ERRCODES_IGNORE, ierr)
      call MPI_RECV(rank1, 1, MPI_INTEGER, 0, 0, intercomm,
     &              status, ierr)
      call MPI_RECV(rank2, 1, MPI_INTEGER, 1, 1, intercomm,
     &              status, ierr)
      print *, "Slaves ", rank1, " and ", rank2, " are working"
      call MPI_FINALIZE(ierr)
      end
