C-------------------------------------------------------------------------- subroutine ftpunt(ounit,keywrd,kunit,status) C write the units string in a header record C C ounit i fortran output unit number C keywrd c keyword name ( 8 characters, cols. 1- 8) C kunit c keyword units string C OUTPUT PARAMETERS: C status i output error status (0 = ok) C C written by Wm Pence, HEASARC/GSFC, July 1997 character*(*) keywrd,kunit integer ounit,status,lenval,ii,clen,olen character card*80,value*80,knam*8,ocmnt*72,ncmnt*72 if (status .gt. 0)return knam=keywrd C find the old keyword call ftgcrd(ounit,knam,card,status) if (status .eq. 202)then call ftpmsg('FTPUNT Could not find the '//knam//' keyword.') return end if C parse the record to find value and comment strings call ftpsvc(card,value,ocmnt,status) C get the length of the keyword name + value string call ftprsv(card,lenval,status) if (status .gt. 0)return C write the units string, in square brackets, to the new comment clen=1 if (kunit .ne. ' ')then ncmnt='['//kunit do 10 ii = 72,1,-1 if (ncmnt(ii:ii) .ne. ' ')then clen = ii+1 ncmnt(clen:)='] ' clen=clen+2 go to 20 end if 10 continue 20 continue end if C check for existing units field in the comment olen=1 if (ocmnt(1:1) .eq. '[')then do 30 ii = 2,72 if (ocmnt(ii:ii) .eq. ']')then olen=ii+1 if (ocmnt(olen:olen) .eq. ' ')olen=olen+1 go to 40 end if 30 continue end if 40 continue C concatinate the old comment string to the new string ncmnt(clen:)=ocmnt(olen:) C construct the whole new card card(lenval+1:)=' / '//ncmnt C modify the keyword record call ftmodr(ounit,card,status) end