8      SUBROUTINE SPOTCHECK (NCJ,IB,IA,NLINES,ID1,XXUSER)JC_TITLE  SPOTCHECK  Applys constraints to XG data for each spot requested.C_ARGUMENTSJ      INTEGER NCJ      	      ![I] Number of database variables requested.C      INTEGER*2 IB(60)        ![I] File control block for database.J      INTEGER*2 IA(NLINES,ID1) ![I] Contains requested database variables.<      INTEGER NLINES   	      ![I] Number of records/sector.N      INTEGER ID1             ![I] Maximum number of columns allowed preset by			      !user dummy routine.O      REAL XXUSER             ![I] Name of user application routine (external).C_VARIABLES&      INCLUDE 'RAD$INC:XXCOM.INC/LIST'C					Uses: IOUT, NOSPOT."C				        Modifies: KS, J1, J2.(      INCLUDE 'RAD$INC:XXGCOM.INC/LIST' .C					Uses: MXNCOL, NCOL, KSPOTS, NSPTS, ICOL.C					Modifies: None.IC_DESCRIPTION  The subroutine SPOTCHECK loops through the data, applying IC constraints to each column identification (principal variable) for eachMC spot requested.  SPOTCHECK also invokes module XXGP with mode equal to one,0C extracting a sector of data from the database.%C_CALLS  XXSPOT  XXGP  XXGCON  XXUSEROC_HISTORY  87July01 Robert L. Gurule  USGS Flagstaff, AZ.  Extracted code from NC          XGDATA, modified into subroutine, NIMS/VIMS documentation standard.C_END      EXTERNAL XXUSER	FC-----Routine to loop through each spot, read requested data from disk7C-----KINT=9999 start with first point of the sequence.      KINT = 9999      KROW=0
      KSK = 17C------Row loop                                        6C------Spot loop: modify column number's if necessary. 50    DO 65 ISPT=1,NSPI,1       KS = KSPOTS(ISPT)       IF (KSPOTS(2).NE.1)THEN&         CALL XXSPOT(ICOL,NCOL,KS-KSK)?         IF(NCJ.GT.0)CALL XXSPOT(ICOL(MXNCOL+1-NCJ),NCJ,KS-KSK)       ENDIF
       KSK=KS=C-------TYPE 1: Read requested columns for this row from disk:C       always do this (do something else if ibtype = -1).        DO 55 K=1,NCOL          KCOL=ICOL(K)AC------Skip read if non-spot dependent column and not first spot.EC      In other words, read if you need more data because what you're"C      looking for you don't have.F       IF((KS.EQ.KSPOTS(1) .AND .KCOL.GT.NOSPOT) .OR. (KCOL.GT.0))THEN-         CALL XXGP(1,IB,KCOL,KROW,IA(1,K),IR)         IF (IR.EQ.-1) GO TO 70         IF (IR.NE.0) GO TO 81       ENDIF 55    CONTINUE CC------Call user routine for data processing, computation of output+C      column values (if any) for this row.       CONTINUE        J1 = JIFIX(FLOATI(IB(7)))        J2 = JIFIX(FLOATI(IB(8)))GC-----Apply constraints, compute functions, apply function constraints,IC     apply interval logic.  return flag to skip in sign bit of time var.!      CALL XXGCON(IA,NLINES,KINT)  !      CALL XXUSER(3,IA,NLINES,IR)6C-----Terminate sequence or run early on user request./      IF (IR.NE.0) GO TO (81,81,81,70,77,81),IR;C----- Should we output columns?, yes, is if write allowed?.      IF ((IB(10).NE.0) .AND. (NCJ.GT.0)) THEN'C-----No, turn off output and continue.
        NCJ=0        WRITE (IOUT,958)> 958    FORMAT (' ATTEMPTED UNAUTHORIZED WRITE TO DATABASE -',     1  ' OUTPUT SHUT OFF')      ENDIF 65   CONTINUE0C-----End spot loop: increment row, go get next.      KROW=KROW+1      GO TO 50  81  IF(IR.NE.0)THEN"        TYPE*, ' ERROR IN XXUSER '      ENDIF        77  CONTINUE  70  RETURN	      END