C---------------------------------------------------------------------- subroutine ftuptf(iunit,status) C Update the value of the TFORM keywords for the variable length array C columns to make sure they all have the form 1Pt(len) or Pt(len) C where 'len' is the maximum length of the vector in the table (e.g., C '1PE(400)') C iunit i fortran unit number C status i output error status C C written by Wm Pence, HEASARC/GSFC, Jan, 1997 integer iunit,status integer ii,tflds,naxis2,maxlen,jj,length,addr,endpos,cpos character comment*80, keynam*8,tform*40,newfrm*40 character message*80,lenstr*20 call ftgkyj(iunit,'TFIELDS', tflds, comment, status) call ftgkyj(iunit,'NAXIS2', naxis2, comment, status) do 100 ii = 1,tflds call ftkeyn('TFORM',ii,keynam,status) call ftgkys(iunit,keynam,tform,comment,status) if (status .gt. 0)then message='Error while updating variable length TFORMn '// & 'values (ftuptf)' call ftpmsg(message) end if C test if this is a variable length array column if (tform(1:1) .eq. 'P' .or. tform(2:2) .eq. 'P')then C test if the length field is missing if (tform(5:5) .eq. ' ')then maxlen = 0 do 50 jj=1,naxis2 call ftgdes(iunit,ii,jj,length,addr,status) maxlen = max(maxlen,length) 50 continue if (tform(1:1) .eq. 'P')then endpos=3 else endpos=4 end if C convert integer to C*20 string, and find first digit call fti2c(maxlen,lenstr,status) do 60 jj = 1, 20 cpos = jj if (lenstr(cpos:cpos) .ne. ' ')go to 70 60 continue C construct new keyword value 70 newfrm=tform newfrm(endpos:)='('//lenstr(cpos:20)//')' C now modify the old TFORMn keyword call ftmkys(iunit,keynam,newfrm,comment,status) end if end if 100 continue end