      program example25b
      include 'mpif.h'
      integer ierr, rank, position
      real a(10)
      character b(10), buf(100)
      call MPI_INIT(ierr)
      call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
      do i = 1, 10
         a(i) = rank + 1.0
         if(rank .eq. 0) then
            b(i) = 'a'
         else
            b(i) = 'b'
         end if
      end do
      position=0
      if(rank .eq. 0) then
         call MPI_PACK(a, 10, MPI_REAL, buf, 100, position,
     &                 MPI_COMM_WORLD, ierr)
         call MPI_PACK(b, 10, MPI_CHARACTER, buf, 100, position,
     &                 MPI_COMM_WORLD, ierr)
         call MPI_BCAST(buf, 100, MPI_PACKED, 0,
     &                  MPI_COMM_WORLD, ierr)
      else
         call MPI_BCAST(buf, 100, MPI_PACKED, 0,
     &                  MPI_COMM_WORLD, ierr)
         position=0
         call MPI_UNPACK(buf, 100, position, a, 10, MPI_REAL,
     &                   MPI_COMM_WORLD, ierr)
         call MPI_UNPACK(buf, 100, position, b, 10,
     &                   MPI_CHARACTER, MPI_COMM_WORLD, ierr)
      end if
      print *, 'process ', rank, ' a=', a, ' b=', b
      call MPI_FINALIZE(ierr)
      end
