Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50212/distr3.f4
There are no other files named distr3.f4 in the archive.
      SUBROUTINE DISTR3(NK,IFA,IP,ITABLE,LOCR,NSPK,IB)
C*****THIS SUBROUTINE SETS UP THE DISTRIBUTION TABLE WHICH WILL BE USED
C*****IN PREDICTING ADDRESSES ******************************************
C*****IT CALCULATES THE DISTRIBUTION FOR WHATEVER FILE IS IN COMMON
C*****NK- WHAT WORD IN THE RECORD THE DISTRIBUTION WILL BE ON
C*****IFA =2 IF TWO DIGITS  AT A TIME =1 IF ONE DIGIT, =3 IF 1 ALPHA CHARACTER
C*****IP - LETTER OR DIGIT IN THE WORD FROM LEFT TO RIGHT
C*****ITABLE WILL HOLD THE DISTRIBUTION TABLE
C*****LOCR - SECTOR NUMBER WITHIN A RECORD IN IDI WHERE THE FIRST WORD
C*****OF THE KEY IS LOCATED
C*****NSPK - NUMBER OF SECTORS WHICH HOLD THE KEY
      DIMENSION JPAR(10),IPAR(10),ITABLE(100),IFRMT(1),IB(10)
	COMMON IDF,LFR,NAVR,MAXR,NSPR,LSR,LFMT,NCPR,LPTR,C1
      EQUIVALENCE (IPAR(1),IDF)
C*****CALCULATE THE PARAMETERS FOR IUNPAK
	GO TO(1,2,3)IFA
1	IMP=10
	IFA1=1
	GO TO 4
2	IMP=5
	IFA1=2
	GO TO 4
3	IFA1=2
	IMP=5
4	N1=IFA1*(IMP-IP)
	N2=IFA1*(IP-1)
C*****INITIALIZE THE DISTRIBUTION TABLE TO ZERO
	DO 45 I=1,128
45    ITABLE(I)=0
C*****LOOP THROUGH ALL THE RECORDS IN THE MASTER FILE ******************
      NR=(NAVR-LFR)/NSPR
      ILOC=LFR+LOCR-1
      DO 410 II=1,NR
C*****ILOC POINTS TO SECTOR WHICH CONTAINS THE FIRST WORD OF THE KEY
C*****READ INTO IB THE WORDS OF THE KEY
      CALL DIO(ILOC,1,IB,NSPK)
C*****CALCULATE THE NUMERIC CODE OF THE DESIRED NUMBER OR LETTER
	IF(IFA.EQ.3)GO TO 5
      NCODE=IUNPAK(N1,N2,IB(NK))+1
C*****INCREMENT THE TABLE FOR THAT CODE
6	ITABLE(NCODE)=ITABLE(NCODE)+1
410   ILOC=ILOC+NSPR
C*****FORM THE CUMULATIVE DISTRIBUTION FUNCTION
      DO 425 I=1,127
425   ITABLE(I+1)=ITABLE(I+1)+ITABLE(I)
	RETURN
5	NCODE=JUNPAK(N1/2,N2/2,IB(NK))+1
	GO TO 6
	END