SUBROUTINE cal(diff) $$IMPLICIT $$INCLUDE 'C$INC:BCS.INC' $$INCLUDE 'YBOS$LIBRARY:ERRCOD.INC' REAL diff ! difference between first and last INTEGER n ! size of TAU data INTEGER m ! size of vector INTEGER ind, index ! bank and data index of TAUS INTEGER blocat ! YBOS named bank finder INTEGER wbank ! YBOS work bank creator INTEGER wdrop ! YBOS work bank dropper INTEGER windex ! work bank index INTEGER offset ! offset halfway into work bank INTEGER status ! error return status INTEGER i,j ! DO loop indices C................................. diff = 0. status = blocat(iw, 'TAUS', 1, ind, index) IF(status .NE. yesucc) RETURN n = iw(index) ! size of data m = n/12 ! number of elements status = wbank(iw, windex, m) IF(status .NE. yesucc) RETURN DO 1 i = 1, m DO 2 j = 1, 12 iw(windex+1+i) = iw(windex+1+i) + iw(index+12*(i-1)+j) !<--- 2 CONTINUE 1 CONTINUE diff = iw(windex+1+m) - iw(windex+1) !<---- status = wdrop(iw, windex, 1) RETURN END
The format of a work bank is that the first word pointed to is the number of words in the bank. Please don't overwrite this word. You will regret it. Use iw(windex+1+ your_index).