Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50542/rnofi1.for
There is 1 other file named rnofi1.for in the archive. Click here to see a list.
      SUBROUTINE RNOFIL(IFNCTN,IWHAT,NOWUNT,NXTUNT,LMTUNT,
     1ITTY,JTTY,IDFILE)
C     RENBR(/OPEN AND CLOSE SCRATCH AND SPLICE FILES)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     IFNCTN = 1, FIRST FOOTNOTE SCRATCH FILE
C              OR THE SORTED INDEX SCRATCH FILE
C            = 2, SECOND FOOTNOTE SCRATCH FILE
C              OR THE RANDOM INDEX SCRATCH FILE
C            = 3, LOOP FILE
C            = 4, SPLICE FILE
C              NOTE: IF IFNCTN IS 4, AND IWHAT IS 4, THEN
C              THE UNIT NUMBER IS RETURNED, BUT NO FILE IS
C              OPENED.  IT IS EXPECTED THAT THE USER WILL
C              BE ASKED TO SUPPLY THE NAME OF THE SPLICE
C              FILE, AND THAT IT WILL BE OPENED ELSEWHERE
C              FOR READING.
C            = 5, INDEX FILE
C     IWHAT  = 1, OPEN FILE FOR WRITING
C            = 2, CLOSE FILE AFTER WRITING, AND RETAIN IT
C            = 3, CLOSE FILE AFTER WRITING, AND DELETE IT
C            = 4, OPEN FILE FOR READING
C            = 5, CLOSE FILE AFTER READING, AND RETAIN IT
C            = 6, CLOSE FILE AFTER READING, AND DELETE IT
C     NOWUNT  = RETURNED WITH UNIT NUMBER TO BE USED
      DOUBLE PRECISION FILNAM
      DIMENSION FILEXT(5),NXTUNT(LMTUNT)
      DATA FILEXT/3HONE,3HTWO,3HTHR,3HSPL,3HNDX/
C
C     CONSTRUCT FILE NAME
      ENCODE(10,1,FILNAM)IDFILE,FILEXT(IFNCTN)
    1 FORMAT(1I6,1H.,1A3)
C
C     DETERMINE IF OPENING OR CLOSING FILES
      GO TO(2,6,7,2,9,10),IWHAT
C
C     DETERMINE AVAILABLE UNIT NUMBER IF OPENING FILE
    2 DO 3 I=1,LMTUNT
      IF(NXTUNT(I).EQ.0)GO TO 3
      NOWUNT=NXTUNT(I)
      NXTUNT(I)=0
      IF(IWHAT.EQ.1)GO TO 5
      GO TO 8
    3 CONTINUE
      WRITE(ITTY,4)LMTUNT
    4 FORMAT(' ATTEMPT TO OPEN MORE THAN',I2,
     1' SCRATCH UNITS')
      STOP
C
C     OPEN FILE FOR WRITING
    5 OPEN(UNIT=NOWUNT,FILE=FILNAM,ACCESS='SEQOUT')
      GO TO 13
C
C     CLOSE FILE JUST WRITTEN, RETAINING IT
    6 CLOSE(UNIT=NOWUNT)
      GO TO 11
C
C     CLOSE FILE JUST WRITTEN, DELETING IT
    7 CLOSE(UNIT=NOWUNT,DISPOSE='DELETE')
C     CALL EXPUNG ROUTINE TO EXPUNGE DELETED FILES ON DECSYSTEM20
C     THIS ROUTINE WOULD JUST BE A DUMMY FOR USE ON DECSYSTEM10
      CALL EXPUNG
      GO TO 11
C
C     OPEN FILE FOR READING
    8 IF(IFNCTN.EQ.4)GO TO 13
      OPEN(UNIT=NOWUNT,FILE=FILNAM,ACCESS='SEQIN')
      GO TO 13
C
C     CLOSE FILE JUST READ, RETAINING IT
    9 CLOSE(UNIT=NOWUNT)
      GO TO 11
C
C     CLOSE FILE JUST READ, DELETING IT
   10 CLOSE(UNIT=NOWUNT,DISPOSE='DELETE')
C     CALL EXPUNG ROUTINE TO EXPUNGE DELETED FILES ON DECSYSTEM20
C     THIS ROUTINE WOULD JUST BE A DUMMY FOR USE ON DECSYSTEM10
      CALL EXPUNG
C
C     RETURN UNIT NUMBER TO FREE LIST IF CLOSING FILE
   11 DO 12 I=1,LMTUNT
      IF(NXTUNT(I).NE.0)GO TO 12
      NXTUNT(I)=NOWUNT
      NOWUNT=0
      GO TO 13
   12 CONTINUE
   13 RETURN
      END
      SUBROUTINE RNOEND(IFNCTN,IDISK,JDISK)
C     RENBR(/CLOSE FILES, DECSYSTEM 10 VERSION)
C
C     DONALD E. BARTH, YALE SCHOOL OF MANAGEMENT
C
C     THIS ROUTINE IS CALLED BY FROFF TO CLOSE THE SOURCE
C     AND OUTPUT FILES.
C
C     IFNCTN = 1, CLOSE THE SOURCE FILE
C            = 2, CLOSE THE OUTPUT FILE
C     IDISK  = UNIT NUMBER FROM WHICH SOURCE FILE IS READ
C     JDISK  = UNIT NUMBER TO WHICH OUTPUT FILE IS WRITTEN
C
      IF(IFNCTN.EQ.2)GO TO 1
C
C     CLOSE SOURCE FILE
      CLOSE(UNIT=IDISK)
      GO TO 2
C
C     CLOSE OUTPUT FILE
    1 CLOSE(UNIT=JDISK)
    2 RETURN
      END