	DIMENSION F(4500),STOL(4500),DELTA(4500),SIG(4500),RATIO(4500),
	1D(12),HKL(3),IC(10),SINT(50),FINT(50),FDEL(50),SDEL(50),FDELS(50),
	2SDELS(50),NSINT(50),NFINT(50)
	COMMON  DELTA
	COMMON  F      , STOL   , SINT   , FINT   , FDEL   , SDEL
	COMMON  FDELS  , SDELS  , NPLT   , NUMF   , NUMS   , IC
	COMMON  NSINT  , NFINT  , NCT    , ELAMD  , SIG
	EQUIVALENCE (DELTA(1),RATIO(1))
C
C  PROGRAM WEIGHT       PROGRAMMED FOR THE IBM 7090 BY BOB SNYDER 3/69
C
C                       REVISED FOR THE IBM 360/75 WITH ON LINE TIME
C                       SHRING PLOTTER 11/1/69
C  WEIGHT IS A GENERAL PROGRAM FOR DETERMIMING AN IDEALIZED WEIGHTING
C  SCHEME FOR LEAST SQUARES BASED ON THE PREMISE THAT (FO-FC)/SIG SHOULD
C  EQUAL 1.0 FOR ALL RANGES OF FO OR SIN THETA/LAMBDA (STOL)
C
C  THE PROGRAM OPERATES BY READING FO,FC,SIGMA(FO),AND SIN(THETA) FROM
C  EITHER SHIONOS 7090 ORFLS OUTPUT TAPE OR THE X-RAY 63 DATA TAPE
C  FROM THESE VALUES DELTA / SIGMA IS COMPUTED AND
C  AVERAGED OVER INTERVALS OF FO AND STOL A WEIGHT PATCH SUITABLE FOR
C  USE IN THE L.S. IS PUNCHED WITH SIGMA VALUES WHICH WILL CAUSE THE
C  AVERAGE DELTA/SIGMA TO EQUAL 1.0 IN EACH INTERVAL
C  OPTIONS ARE ALLOWED FOR PLOTTING THE FOLLOWING
C        1  ALL DELTA/SIGMA VALUES VS. FO
C        2  ALL DELTA/SIGMA VALUES VS. STOL
C        3  THE AVERAGED DELTA/SIGMA VALUES VS. THE INTERVALS OF FO
C        4  THE AVERAGED DELTA/SIGMA VALUES VS. THE STOL INTERVALS
C
C  LIMITATIONS ON THE PRESENT PROGRAM ARE
C    1  THERE MAY BE NO MORE THAN 4500 REFLECTIONS(NOT COUNTING UNOBSERV
C                  (ALL UNOBSERVED REFLECTIONS ARE IGNORED)
C    2  THERE MAY BE NO MORE THAN 50 INTERVALS OF FO OR STOL
C    3  TO INCREACE THE NUMBER OF REFLECTIONS ALLOWED FROM THE PRESENT
C        4500 SIMPLY INCREACE EACH 4500 APPEARING IN THE DIMENSION
C        STATMENTS OF THE MAIN AND ALL SUBROUTINES
C        NO CODING NEED BE CHANGED
C
C  GENERAL COMMENTS
C  1  THE INPUT L.S. TAPE MUST BE MOUNTED ON LOGICAL 10
C  2  ON THE NASA-ERC 360/75 WITH ON LINE TIME SHARING (MVT) PLOTTER A
C     SPECIAL JCL COMMAND IS NECESSARY  NAMELY
C     //PLOTTER  DD  SYSOUT=C
C     IF IT IS EVER DESIRED TO CHANGE THE PROGRAM TO OFF LINE PLOTTING
C     SIMPLY REMOVE THE GRAPH CALL FROM SUBROUTINE PLOT10 AND CALL THE
C     CALCOMP ROUTINE PLOTS WITH NPLT AS AN ARGUMENT.  THE RESULTING
C     PLOTS WILL BE WRITTEN ON LOGICAL 9 AND MAY BE PLOTTED OFF LINE
C
C  CONTROL CARDS FOR THE 360/75
C        THESE CARDS WOULD EXECUTE THE JOB WITH PLOTTS FOR THE FOLLOWING
C        CONDITIONS:    1  A LOAD MODUAL CALLED WEIGHT RESIDES ON DISK(P
C                       2  THE LOAD MODUAL IS A MEMBER OF A PARTITIONED
C                          DATA SET NAMED LOADMOD
C                       3  THE OUTPUT TAPE(10) FROM THE SHIONO ORFLS
C                          IS A SEQUENTIAL DICK FILE( ASSO ON PRIVATE
C                          DISK SER=DA0024)
C  1.    //   I.D.
C  2.    //STEP1  EXEC  PGM=WEIGHT,REGION=150K
C  3.    //STEPLIB  DD  DSN=LOADMOD,DISP=(OLD,PASS)UNIT=2314,          X
C        //   VOL=(PRIVATE,RETAIN,SER=DA0024)
C  4.    //SYSPRINT  DD  SYSOUT=A
C  5.    //FT05F001  DD  DDNAME=SYSIN
C  6.    //FT36F001  DD  SYSOUT=A
C  7.    //FT07F001  DD  SYSOUT=B
C  8.    //FT10F001  DD  DSN=ORFLSTAP,UNIT=2314,DISP=(OLD,PASS),       X
C        //   VOL=(PRIVATE,RETAIN,SER=DA0024)
C  9.    //PLOTTER  DD  SYSOUT=C
C  10.   //SYSIN  DD  *
C  11.   CONTROL CARD
C  12.   /*
C
C  CONTROL CARD FORMAT       (10I1,2I5,F10.6)
C        COL 1     =0  PUNCH WEIGHTING FACTORS BASED ON FO ANALYSIS
C                  =1  DO NOT PUNCH
C        COL 2     =0  PUNCH WEIGHTING FACTORS BASED ON STOL ANALYSIS
C                  =1 DO NOT PUNCH
C        COL 3     =0  PLOT ALL DELTA/SIGMA VS. FO VALUES
C                  =1  BYPASS PLOT
C        COL 4     =0  PLOT ALL DELTA/SIGMA VS. STOL VALUES
C                  =1  BYPASS PLOT
C        COL 5     =0  PLOT AVERAGED DELTA/SIGMA VS. FO VALUES
C                  =1  BYPASS PLOT
C        COL 6     =0  PLOT AVERAGED DELTA/SIGMA VS. STOL VALUES
C                  =1  BYPASS PLOT
C        COL 7     =0  INPUT FROM SHIONO 7090 ORFLS TAPE
C                  =1  INPUT FROM X-RAY 63 DATA TAPE
C        COL 8     =0  DO NOT LIST SORTED F LIST
C                  =1 LIST SORTED F
C        COL 11-15   THE NO. OF FO VALUES TO BE INCLUDED IN EACH INTERVA
C                       IF BLANK OR ZERO DATA WILL BE EQUALLY DIVIDED
C                       AMONG 15 INTERVALS (REMEBER 50 IS MAX)
C        COL 15-20   THE NUMBER OF STOL INTERVALS TO BE USED THESE
C                       INTERVALS WILL BE SET SO AS TO INCLUDE APPROX.
C                       EQUAL NUMBERS OF REFLECTIONS)
C                       IF ZERO OR BLANK 15 IS ASSUMED
C        COL 21-30      LAMBDA  ONLY NEEDED IF X-RAY 63 TAPE IS INPUT
C
C  NOTE IN CHOOSING THE NUMBER OF INTERVALS YOU MUST INCLUDE A
C  STATISTICALLY REPRESENTATIVE NO. OF POINTS (40. IS ABOUT MIN. NO.)
C
C
C
	NTAP = 10
	REWIND NTAP
C
C  AT PRESENT TAPE 9 NPLT IS NOT USED BUT IS IN COMMON FOR FUTURE USAGE
C
	NPLT = 9
	SUMD = 0.0
	SUMWD = 0.0
	SUMF = 0.0
	SUMWF = 0.0
	NCT = 0
	SMAX = 0.0
C
C  READ CONTROL CARD
C
	READ 1,IC,NUPF,NUMS,ELAMD
1	FORMAT(10I1,2I5,F10.6)
	PRINT5,IC,NUPF,NUMS
5	FORMAT(1H1,20H CONTROL PARAMETERS , 10I2,2I5)
	IF(IC(7))101,101,102
C
C  READ CELL CONSTANT RECORD FROM SHIONO 7090 BINARY ORFLS TAPE
C
101	READ  (NTAP)D,ELAMD
	PRINT 10,(D(I),I=7,12),ELAMD
10	FORMAT(25H0A,B,C,ALPHA,BETA,GAMMA =  ,6F8.4//9H LAMBDA = ,F10.6)
	GO TO 105
C
C  READ FIRST 7 RECORDS OFF X-RAY 63 DATA TAPE SAVING LAMBDA AND SCALE
C
102	READ  (NTAP)D
	PRINT 10,(D(I),I=4,9),ELAMD
	DO 103 I = 1,5
103	READ  (NTAP)D(1)
	READ  (NTAP)D
	NUMD = D(6)
C
C  PRINT HEADER
C
105	PRINT 20
20	FORMAT( 30H1DATA USED FOR WEIGHT ANALYSIS  / 49H  H  K  L    FO
	1   DELTA     SIGMA    SINT/L    /)
	IF(IC(7))100,100,141
C
C  READ DATA FROM BINARY 7090 ORFLS TAPE
C
100	NCT = NCT + 1
110	READ  (NTAP)HKL,F(NCT),FC,(D(I),I=1,4),SIG(NCT),D(1),ID,D(1),  STO
	1L(NCT)
	IF(HKL(1)-999.0)115,150,150
115	IF(ID)120,120,110
120	DELTA(NCT) = ABS(F(NCT) - FC)
	SUMD = SUMD + DELTA(NCT)
	SUMWD = SUMWD + DELTA(NCT)**2/SIG(NCT)**2
	SUMF = SUMF + F(NCT)
	SUMWF = SUMWF + F(NCT)**2/SIG(NCT)**2
	STOL(NCT) = STOL(NCT)/ELAMD
	IF(STOL(NCT)-SMAX)140,140,130
130	SMAX = STOL(NCT)
140	PRINT 30,HKL,F(NCT),DELTA(NCT),SIG(NCT),STOL(NCT)
30	FORMAT(1X3F3.0,4F10.4)
	GO TO 100
C
C  READ DATA FROM X-RAY 63 REFLECTION (FC) TAPE
C
141	DO 149 I = 1,NUMD
	READ  (NTAP)HKL,F(I),STOL(I),ID,J,D
	IF(ID - 1)142,142,149
142	DELTA(I) = ABS(F(I) - D(8))
	SUMD = SUMD + DELTA(I)
	SUMWD = SUMWD + (DELTA(I)**2) * D(1)
	SUMF = SUMF + F(I)
	SUMWF = SUMWF +(F(I)**2) * D(1)
	SIG(I) = SQRT(1.0/D(1))
	IF(STOL(I) - SMAX)144,144,143
143	SMAX = STOL(I)
144	PRINT 30,HKL,F(I),DELTA(I),SIG(I),STOL(I)
149	CONTINUE
	GO TO 151
150	NCT = NCT - 1
	NUMD = NCT
151	PRINT32,NUMD
32	FORMAT( 24H0NUMBER OF REFLECTIONS =  I6)
	CALL SORT(NUMD)
C
C  DETERMINE THE NUMBER OF INTERVALS OF FO IF UNSPECIFIED
C
	IF(NUPF)160,160,165
160	NUPF = NUMD / 15
165	NUMF = NUMD / NUPF
	IF(NUMF - 50)170,170,160
C
C  DETERMINE THE INTERVALS OF STOL PROPORTIONAL TO V**3
C
170	IF(NUMS)180,180,190
180	NUMS = 15
190	TEST = 0.0
200	TEST = TEST + .001
	DO 220 I=1,50
	AI = I
	SINT(I) = (AI * TEST)**(1.0/3.0)
	IF(SINT(I) - SMAX)220,210,210
210	NUMT = I
	GO TO 230
220	CONTINUE
	GO TO 200
230	IF(NUMT - NUMS)240,240,200
240	NUMS = NUMT
	I = 0
	MOUSE = 0
	MOLE = 1
	DO 245 N=1,50
	FDEL(N) = 0
	FDELS(N) = 0
	SDEL(N) = 0
	SDELS(N) = 0
	NFINT(N) = 0
245	NSINT(N) = 0
C
C  BEGIN LOOP TO 310 ASSIGNING REFLECTIONS TO THEIR INTERVALS AND
C  DETERMINING AVERAGE VALUES FO DELTA AND DELTA/SIGMA
C
250	I = I + 1
	IF(I -   NUMD    )260,260,310
260	NFINT(MOLE) = NFINT(MOLE) + 1
	FDELS(MOLE) = FDELS(MOLE) + DELTA(I)/SIG(I)
	FDEL(MOLE) = FDEL(MOLE) + DELTA(I)
	MOUSE = MOUSE + 1
	IF(MOUSE - NUPF)280,270,270
270	AMOUSE = MOUSE
	FINT(MOLE) = F(I)
	FDELS(MOLE) = FDELS(MOLE) / AMOUSE
	FDEL(MOLE) = FDEL(MOLE) / AMOUSE
	MOLE = MOLE + 1
	MOUSE = 0
280	DO 300 J=1,NUMS
	IF(STOL(I) - SINT(J))290,290,300
290	NSINT(J) = NSINT(J) +1
	SDEL(J) = SDEL(J) + DELTA(I)
	SDELS(J) = SDELS(J) + DELTA(I)/SIG(I)
	GO TO 250
300	CONTINUE
	PRINT 40
40	FORMAT(26H0STOL INTERVALS SCREWED UP )
	CALL EXIT
310	IF(MOUSE)315,315,320
315	MOLE = MOLE - 1
	GO TO 330
320	AMOUSE = MOUSE
	FDELS(MOLE) = FDELS(MOLE) / AMOUSE
	FINT(MOLE) = F(I-1)
	FDEL(MOLE) = FDEL(MOLE) / AMOUSE
C
C  ADJUST NUMF TO ACTUAL NO. OF F INTERVALS USED
C
330	NUMF = MOLE
	DO 340 I=1,NUMS
	AMOUSE = NSINT(I)
	SDELS(I) = SDELS(I) / AMOUSE
340	SDEL(I) = SDEL(I) / AMOUSE
C
C  PRINT SORTED F LIST WITH DELTA/SIGMA VALUES
C
	IF(IC(8))470,470,345
345	PRINT 42
42	FORMAT(  19H1DATA AFTER SORTING  /  33H    FO       STOL   DELTA/S
	1IGMA  )
	DO 350 I = 1,NUMD
350	PRINT 44,F(I),STOL(I),RATIO(I)
44	FORMAT(3F10.4)
C
C  PUNCH MODIFY SUBROUTINE BASED ON DELTA/SIGMA VS. FO
C
470	IF(IC(1))480,480,520
480	PUNCH 70
70	FORMAT(6X,66HSUBROUTINE MODIFY(FH,FK,FL,FO,FC,AO,AC,BO,BC,SIG,Q,ID
	1,SINT,CA,CB,C  /  5X, 18H1C,CD,CE,CF,RA,RB)  /  6X14HIF(ID)20,20,1
	20  / 3X, 10H10 SIG=0.0  /  6X,6HRETURN  )
	PRINT 72
72	FORMAT(39H0MODIFY BASED ON F-PLOT WILL BE PUNCHED)
	I = 0
490	I = I + 1
	IF(I - NUMF)500,510,510
500	J = 2*I*10
	K = J + 10
	L = K + 10
	PUNCH 74,J,FINT(I),K,K,L
74	FORMAT(I5,1X8HIF(FO - ,F10.4,1H),I4,1H,,I4,1H,,I4)
	PUNCH 76,K,FDEL(I)
76	FORMAT(I5,1X5HSIG =,F10.6/6X6HRETURN)
	GO TO 490
510	PUNCH 78,L,FDEL(I)
78	FORMAT(I5,1X5HSIG =,F10.6/6X6HRETURN/6X3HEND//)
C
C  PUNCH MODIFY BASED ON DELTA/SIGMA VS. STOL PLOT
C
520	IF(IC(2))530,530,570
530	PRINT 80
80	FORMAT(42H0MODIFY BASED ON STOL PLOT WILL BE PUNCHED  )
	PUNCH 70
	I = 0
540	I = I + 1
	IF(I - NUMS)550,560,560
550	J = 2*I*10
	K = J + 10
	L = K + 10
	SINE    = SINT(I) * ELAMD
	PUNCH 82,J,SINE   ,K,K,L
82	FORMAT(I5,1X10HIF(SINT - ,F10.4,1H),I4,1H,,I4,1H,,I4)
	PUNCH 76,K,SDEL(I)
	GO TO 540
560	PUNCH 78,L,SDEL(I)
C
C  PRINT RESULTS OF AVERAGING
C
570	PRINT 84,NUMF
84	FORMAT(23H1RESULTS OF FO ANALYSIS ,I6,10H INTERVALS  /)
	PRINT 86
86	FORMAT(8X9H INTERVAL ,14X8H AVERAGE ,6X10H NUMBER OF ,9X9H  AVERAG
	1E /3X4H LOW,
	210X5H HIGH , 9X12H DELTA/SIGMA ,4X12H REFLECTIONS,5X6H DELTA)
	ZERO = 0.0
	PRINT 88,ZERO,FINT(1),FDELS(1),NFINT(1),FDEL(1)
88	FORMAT(2(F10.4,5X),F10.6,5XI6,10XF10.6)
	DO 580 I=2,NUMF
580	PRINT 88,FINT(I-1),FINT(I),FDELS(I),NFINT(I),FDEL(I)
	PRINT 90,NUMS
90	FORMAT(//25H0RESULTS OF STOL ANALYSIS ,I6,10H INTERVALS /)
	PRINT 86
	PRINT 88,ZERO,SINT(1),SDELS(1),NSINT(1),SDEL(1)
	DO 590 I = 2,NUMS
590	PRINT 88,SINT(I-1),SINT(I),SDELS(I),NSINT(I),SDEL(I)
C
C  CALCULATE AND PRINT R VALUES
C
	R = SUMD / SUMF
	RW = SQRT( SUMWD / SUMWF )
	DNUM = NUMD
	FIT = SQRT(SUMWD / DNUM)
	PRINT 600,R
600	FORMAT(///15H UNWEIGHTED R =,  F7.4// 41H VALUES FOR 1.0/SIGMA**2
	1WEIGHTING SCHEME   )
	PRINT 610,RW,SUMWD,FIT
610	FORMAT( 18H0WEIGHTED R FACTOR,F7.4/ 19H SUM(W*(O-C)**2 IS  ,E14.7/
	129H SQRTF(SUM(W*(O-C)**2)/NO) IS  ,F10.4)
C
C  CALCULATE VALUES BASED ON NEW WEIGHTING SCHEMES
C
	FSWD = 0.0
	FSWF = 0.0
	SSWD = 0.0
	SSWF = 0.0
	DO 680 I = 1,NUMD
	DO 630 J = 1,NUMF
	IF(F(I) - FINT(J))620,620,630
620	FSWF = FSWF + F(I)**2/FDEL(J)**2
	FSWD = FSWD + DELTA(I)**2/FDEL(J)**2
	GO TO 640
630	CONTINUE
	GO TO 300
640	DO 660 J = 1,NUMS
	IF(STOL(I) - SINT(J))650,650,660
650	SSWF = SSWF + F(I)**2/SDEL(J)**2
	SSWD = SSWD + DELTA(I)**2/SDEL(J)**2
	GO TO 670
660	CONTINUE
	GO TO 300
C
C  CONVERT DELTA ARRAY TO RATIO    DELTA/SIGMA
C
670	RATIO(I) = DELTA(I) / SIG(I)
680	CONTINUE
	RW = SQRT( FSWD / FSWF )
	FIT = SQRT(FSWD / DNUM)
	PRINT 690
690	FORMAT(//40H VALUES FOR WEIGHTS BASED ON FO ANALYSIS)
	PRINT 610,RW,FSWD,FIT
	RW = SQRT( SSWD / SSWF )
	FIT = SQRT(SSWD / DNUM)
	PRINT 695
695	FORMAT(//42H VALUES FOR WEIGHTS BASED ON STOL ANALYSIS  )
	PRINT 610 ,RW,SSWD,FIT
	REWIND NTAP
C
C  CALL PLOTTING SECTION IF REQUESTED
C
	IF(IC(3))400,400,410
400	CALL PLOT10(F(1),RATIO(1),NCT,10HF-OBSERVED,10  ,16HABS(DELTA/SIGM
	1A),16  ,-1,10.0,10.0)
	PRINT 50
50	FORMAT(///22H0DEL/SIG VS. F PLOTTED   )
410	IF(IC(4))420,420,430
420	CALL PLOT10(STOL(1),RATIO(1),NCT,17HSIN(THETA)/LAMBDA,17  ,16HABS(
	1DELTA/SIGMA),16  ,-1,10.0,10.0)
	PRINT 55
55	FORMAT(25H0DEL/SIG VS. STOL PLOTTED  )
430	IF(IC(5))440,440,450
440	CALL PLOT10(FINT(1),FDELS(1),NUMF,10HF-OBSERVED,10  ,20HAVERAGE(DE
	1LTA/SIGMA),20  ,+1,10.0,10.0)
	PRINT 60
60	FORMAT(26H0AV. DEL/SIG VS. F PLOTTED )
450	IF(IC(6))460,460,700
460	CALL PLOT10(SINT(1),SDELS(1),NUMS,17HSIN(THETA)/LAMBDA,17  ,20HAVE
	1RAGE(DELTA/SIGMA),20  ,+1,10.0,10.0)
	PRINT 65
65	FORMAT(29H0AV. DEL/SIG VS. STOL PLOTTED  )
700	IF(IC(3)+IC(4)+IC(5)+IC(6).GT.0) CALL PLOT(15.0,0.0,999)
	STOP
	END
	SUBROUTINE SORT(LIM)
	DIMENSION F(4500),STOL(4500),RATIO(4500),SINT(50),FINT(50),FDEL(50
	1),SDEL(50),FDELS(50),SDELS(50),SIG(4500),IC(10),NSINT(50),NFINT(50
	2)
	DIMENSION DELTA(4500)
	COMMON  DELTA
	COMMON  F      , STOL   , SINT   , FINT   , FDEL   , SDEL
	COMMON  FDELS  , SDELS  , NPLT   , NUMF   , NUMS   , IC
	COMMON  NSINT  , NFINT  , NCT    , ELAMD  , SIG
	EQUIVALENCE (DELTA(1),RATIO(1))
C  LIM= THE NUMBER OF DATA TO BE SORTED
	M1=LIM
51	M1=M1/2
	IF(M1)52,40,52
52	M2=LIM-M1
	M3=1
53	M4=M3
	CALL MOVE(M4,M1)
	M3=M3+1
	IF(M3-M2)53,53,51
40	RETURN
	END
	SUBROUTINE MOVE(M4,M1)
	DIMENSION F(4500),STOL(4500),RATIO(4500),SINT(50),FINT(50),FDEL(50
	1),SDEL(50),FDELS(50),SDELS(50),SIG(4500),IC(10),NSINT(50),NFINT(50
	2)
	DIMENSION DELTA(4500)
	COMMON  DELTA
	COMMON  F      , STOL   , SINT   , FINT   , FDEL   , SDEL
	COMMON  FDELS  , SDELS  , NPLT   , NUMF   , NUMS   , IC
	COMMON  NSINT  , NFINT  , NCT    , ELAMD  , SIG
	EQUIVALENCE (DELTA(1),RATIO(1))
54	M5 = M4 + M1
	IF(F(M4)-F(M5))57,57,55
55	AHOLD = F(M4)
	F(M4) = F(M5)
	F(M5) = AHOLD
	AHOLD=SIG(M4)
	SIG(M4)=SIG(M5)
	SIG(M5)=AHOLD
	AHOLD = RATIO(M4)
	RATIO(M4) = RATIO(M5)
	RATIO(M5) = AHOLD
	AHOLD = STOL(M4)
	STOL(M4) = STOL(M5)
	STOL(M5) = AHOLD
	M4 = M4 - M1
	IF(M4-1)57,54,54
57	RETURN
	END
	SUBROUTINE PLOT10(X,Y,N,NXLA,NX,NYLA,NY,IPEN,XSIZE,YSIZE)
	DIMENSION NXLA(50), NYLA(50)
	DIMENSION X(2),Y(2)
C  DIMENSION A BUFFER AREA OF 1000 LOCATIONS (IBUF) TO BE USED FOR ON
C  LINE PLOTTING SYSTEMS.  THIS AREA IS ONLY REFERED TO BY FORTRAN IN TH
C  CALL TO PLOT10
C     DIMENSION IBUF(1000 )
C
C  PLOT10 IS INTENDED AS A GENERAL PLOTTING SUBROUTINE REQUIRING AS
C  LITTLE USER SPECIFICATION AS POSSIABLE
C
C  MEANING OF CALLED PARAMETERS
C   X  IS AN ARRAY OF UNSCALED ABISSICA
C   Y IS AN ARRAY OF UNSCALED ORDINATE
C   N  IS THE NUMBER OF WORDS IN THE X AND Y ARRAYS
C   NXLA  IS THE LABLE FOR THE X AXIS WHICH MAY BE EITHER A HOLORATH
C         CONSTANT (EG. 16HTITLE FOR X-AXIS) OR XEXADECIMAL CODE
C   NX  IS THE NUMBER OF CHARACTORS IN THE X TITLE (IN EG. NX=16 )
C    NYLA   PLOTTER Y AXIS
C   NY  NUMBER OF CHARACTORS IN Y TITLE
C   IPEN = +1  PLOTTED POINTS WILL BE CONNECTED BY LINES
C        = -1  ONLY POINTS WILL BE PLOTTED
C   XSIZE  THE SIZE OF THE PLOT IN THE X DIRECTION ( 120 FEET MAX)
C   YSIZE  THE SIZE OF THE PLOT IN THE Y DIRECTION
C        FOR NORMAL 11 INCH PAPER THE MAX YSIZE IS 10 INCHES
C        BY SPECIAL REQUEST YOU CAN GET 29.5 INCH PAPER MOUNTED
C        IN THIS CASE THE MAX YSIZE IS 28.5 INCHES
C
C
C
C  DRIVE PEN ALL THE WAY TO THE BOTTOM OF THE PAPER
C
	CALL PLOT(0.0,-29.5,-3)
C  INITIALIZE THE PLOTTING SYSTEM BY CALLING THE CALCOMP ROUTINE PLOTS
C  (FOR THE FIRST PLOT ONLY)
C  IF OFF LINE PLOTTING OR PRIVATE TAPE SPOOLING IS EVER DESIRED
C  TAPE 9 (NPLT) IS IN COMMON FOR THIS REASON
C
	DATA NUM/ 0 /
	IF( NUM )10,10,20
10	NUM = 1
	CALL SPLOT
C
C  NOTE EACH DIRECTION MUST BE INITIALIZED AS 1.0 INCHES LARGER THAN
C  ACTUAL PLOT TO ALLOW FOR TITLES ON BORDER
C
20	CALL PLOT( 0.5, 0.5, -3)
C
C  SCALE THE ARRAYS TO THE PLOT DIMENSIONS XN AND YN BY CALLING THE
C  CALCOMP SUBROUTINE SCALE
C
	CALL SCALE(X(1),XSIZE,N,1)
	CALL SCALE(Y(1),YSIZE,N,1)
C
C  PLOT THE X AND Y ARRAYS USING CALCOMP ROUTINE LINE
C
	CALL LINE(X(1),Y(1),N,1,IPEN, 2)
C
C  DRAW THE AXIS IN AND LABLE THEM USING CALCOMP ROUTINE AXIS
C
	CALL AXIS(0.0,0.0,NXLA,-NX,XSIZE,0.0,X(N+1),X(N+2))
	CALL AXIS(0.0,0.0,NYLA,NY,YSIZE,90.0,Y(N+1),Y(N+2))
C
C  TERMINATE PLOT
	CALL PLOT (XSIZE*1.5,0.0,-3)
C
C
C  TO TERMINATE JOB AFTER LAST PLOT HAS BEEN CALCULATED A CALL TO PLOT
C  FROM THE MAIN PROGRAM WITH THE THIRD ARGUMENT = 999 MUST BE MADE  E.G
C
C     CALL PLOT(20.0,0.0,999)
C
	RETURN
	END
