c subroutine FNCOEN_2_FNTENE(ierr) c c expand FNCOEN data into FNTENE bank c c author: bill schmidke 18.07.96 (modified from j. tickner code for BPC) c c update: 26.08.97 error if PMNr out of range c c output: ierr - = 0, all OK c = 1, PMNr out of range (usually corrupt data) c implicit none c integer ierr c #include "partap.inc" #include "fntene.inc" #include "fncoen.inc" #include "fnpmno.inc" c integer i,j,k,l integer max_FNTENE parameter (max_FNTENE = 48) logical FNTENE_exists(max_FNTENE) integer PMNr,ETWord c integer ibits,ibset logical btest c c ierr = 0 c c bag it if no FNCOEN or no FNPMNO c if(coutab(FNCOEN).le.0.or.coutab(FNPMNO).le.0) return c c flag pm's which are in FNTENE c do i=1,max_FNTENE FNTENE_exists(i) = .false. end do if(coutab(FNTENE).gt.0) then do i=1,coutab(FNTENE) call fettab(FNTENE,ID,i) if(FNTENE_PMNr.gt.0.and.FNTENE_PMNr.le.max_FNTENE) + FNTENE_exists(FNTENE_PMNr) = .true. end do endif c c loop over FNCOEN, pack ones missing from FNTENE c do i=1,coutab(FNCOEN) call fettab(FNCOEN,ID,i) do j=1,2 call fettab(FNPMNO,ID,2*(i-1)+j) do k=1,2 PMNr = ibits(FNPMNO_PMNrs,16*(k-1),16) if(PMNr.le.0.or.PMNr.gt.max_FNTENE) then ierr = 1 return else if(.not.FNTENE_exists(PMNr)) then ETWord = ibits(FNCOEN_PMEnLowBytes,8*(2*j+k-3),8) if(btest(ETWord,7)) then do l=8,23 ETWord = ibset(ETWord,l) end do endif ETWord = ibset(ETWord,31) FNTENE_PMNr = PMNr FNTENE_ETWord = ETWord FNTENE_ID = NEXT call instab(FNTENE) endif endif end do end do end do c c successful completion c ierr = 0 return end * *---------------------------------------------------------------- *