program fhostA
c
c Include C type header file.
c
implicit none
#include "fpvm3.h"
c
c Variables:
c
integer pid
integer pids(0:12)
integer bufid, error, N
c
c Register process in PVM.
c
call pvmfserror(1,error)
call pvmfmytid(pid)
write(6,'('' Host: Alive '')')
write(6,'('' Enter a positive integer N <= 100 : '',$)')
read(5,'(i4)')N
c
c Initiate 1 instance of node program.
c
write(6,'('' Host: Spawning "node" process '')')
call pvmfspawn('fnodeA',PVMHOST,'b25c16',1,pids, error)
c
c
c Build PVM Message block containing N.
c
call pvmfinitsend(PVMDEFAULT,bufid)
call pvmfpack(INTEGER4,N,1,1,error)
c
c Send Message.
c
write(6,'('' Host: Sending N to node '')')
call pvmfsend(pids(0),1,error)
c
c Wait for Reply containing new value of N.
c
call pvmfrecv(pids(0),2,error)
call pvmfunpack(INTEGER4,N,1,1,error)
write(6,'('' Host: Received reply from node '')')
write(6,'('' Host: Node has added 2 to N '')')
c
c Print new value of N.
c
write(6,'('' Host: New N = '',i4)')N
c
c Terminate PVM.
c
write(6,'('' Host: Terminating '')')
call pvmfexit(error)
stop
end