module animals
type calf
   character (10) :: id
   integer :: year_of_birth
   character :: sex
end type
end module

program registration
use animals
implicit none
type (calf) :: a,b

do
   print*,'Input information on an animal or type stop'
   print*,'Name?'
   read*,a%id

   if(a%id == 'stop') exit

   print*,'Year of birth?'
   read*,a%year_of_birth

   print*,'Sex?'
   read*,a%sex

   b=a

   print*,'Another Name?'
   read*,b%id

   call print_am(a)
   call print_am(b)

enddo

contains

subroutine print_am(anim)
type (calf) :: anim

print*,'Name:',anim%id
print*,'Year of birth:',anim%year_of_birth
print*,'Sex:',anim%sex

end subroutine

end program registration