C---------------------------------------------------------------------- subroutine ftpcll(ounit,colnum,frow,felem,nelem,lray,status) C write an array of logical values to the specified column of the table. C The binary table column being written to must have datatype 'L' C and no datatype conversion will be perform if it is not. C ounit i fortran unit number C colnum i number of the column to write to C frow i first row to write C felem i first element within the row to write C nelem i number of elements to write C lray l array of data values to be written C status i output error status C C written by Wm Pence, HEASARC/GSFC, June 1991 integer ounit,colnum,frow,felem,nelem,status logical lray(*) C COMMON BLOCK DEFINITIONS:-------------------------------------------- integer nf,nb,ne parameter (nb = 20) parameter (nf = 3000) parameter (ne = 512) integer bufnum,chdu,hdutyp,maxhdu,hdstrt,hdend,nxthdr,dtstrt integer nxtfld logical wrmode common/ft0001/bufnum(199),chdu(nb),hdutyp(nb),maxhdu(nb), & wrmode(nb),hdstrt(nb,ne),hdend(nb),nxthdr(nb),dtstrt(nb),nxtfld integer tfield,tstart,tbcol,rowlen,tdtype,trept,tnull,heapsz integer theap double precision tscale,tzero common/ft0002/tfield(nb),tstart(nb),tbcol(nf),rowlen(nb), & tdtype(nf),trept(nf),tscale(nf),tzero(nf),tnull(nf),heapsz(nb) & ,theap(nb) character*1 buffer(32000) common/ftheap/buffer C END OF COMMON BLOCK DEFINITIONS----------------------------------- integer bstart,maxpix,i parameter (maxpix = 32000) character messge*80 integer ibuff,i1,ntodo,itodo,repeat,rstart,estart,tcode logical descrp if (status .gt. 0)return if (frow .lt. 1)then write(messge,1001)frow 1001 format('Starting row number is out of range: ',i10) call ftpmsg(messge) status = 307 return else if (felem .lt. 1)then write(messge,1002)felem 1002 format('Starting element number is out of range: ',i10) call ftpmsg(messge) status = 308 return else if (nelem .lt. 0)then write(messge,1003)nelem 1003 format('Negative no. of elements to read or write: ',i10) call ftpmsg(messge) status = 306 return else if (nelem .eq. 0)then C just return if zero rows to write return end if ibuff=bufnum(ounit) C if HDU structure is not defined then scan the header keywords if (dtstrt(ibuff) .lt. 0)call ftrdef(ounit,status) if (colnum .lt. 1 .or. colnum .gt. tfield(ibuff))then write(messge,1004)colnum 1004 format('Specified column number is out of range: ',i10) call ftpmsg(messge) status = 302 return end if i1=1 ntodo=nelem rstart=frow-1 estart=felem-1 C column must be logical data type tcode=tdtype(colnum+tstart(ibuff)) if (tcode .eq. 14)then descrp=.false. repeat=trept(colnum+tstart(ibuff)) if (felem .gt. repeat)then C illegal element number write(messge,1005)felem 1005 format( & 'Starting element number is greater than repeat: ',i10) call ftpmsg(messge) status = 308 return end if else if (tcode .eq. -14)then descrp=.true. repeat=nelem+estart C write the number of elements and the starting offset: call ftpdes(ounit,colnum,frow,repeat, & heapsz(ibuff),status) C move the i/o pointer to the start of the pixel sequence bstart=dtstrt(ibuff)+heapsz(ibuff)+ & theap(ibuff)+estart call ftmbyt(ounit,bstart,.true.,status) C increment the empty heap starting address: heapsz(ibuff)=heapsz(ibuff)+repeat else C error illegal data type code status=310 return end if C process as many contiguous pixels as possible 20 itodo=min(ntodo,repeat-estart,maxpix) if (.not. descrp)then C move the i/o pointer to the start of the sequence of pixels bstart=dtstrt(ibuff)+rstart*rowlen(ibuff)+ & tbcol(colnum+tstart(ibuff))+estart call ftmbyt(ounit,bstart,.true.,status) end if C create the buffer of logical bytes do 10 i=1,itodo if (lray(i1))then buffer(i)='T' else buffer(i)='F' end if i1=i1+1 10 continue C write out the buffer call ftpcbf(ounit,itodo,buffer,status) if (status .gt. 0)then write(messge,1006)i1,i1+itodo-1 1006 format('Error writing elements',i9,' thru',i9, & ' of input data array (FTPCLL).') call ftpmsg(messge) return end if C find number of pixels left to do, and quit if none left ntodo=ntodo-itodo if (ntodo .gt. 0)then C increment the pointers estart=estart+itodo if (estart .eq. repeat)then estart=0 rstart=rstart+1 end if go to 20 end if end