C******************** START FILE UFSCLK.FOR ; GROUP UFSCLK ******************
C-------------------------------------------------------------------
C  UFSCLK
C  LOOK AT SCALARS IN A UFILES FILE
      SUBROUTINE UFSCLK(ILUN,ISHOT,NSC,SCVAL,SCLAB,IORDER,IMOD,ILUNC)
C
      REAL SCVAL(NSC)
      INTEGER IORDER(NSC)
      CHARACTER*10 SCLAB(3,NSC),ZKEY
      CHARACTER*10 ZMODL(2)
      CHARACTER*40 ZFILE
C
C  SCVAL-- LIST OF SCALAR QUANTITY VALUES
C  IORDER-- WORK SPACE TO CALCULATE KEYWORD ALPHABETIC ORDER
C  SCLAB-- LIST OF KEYWORD/LABELS OF SCALARS
C    FIRST 10 CHARACTERS-- KEYWORD TERMINATED BY A ":"
C    SECOND 10 CHARACTERS-- DESCRIPTIVE LABEL
C    THIRD 10 CHARACTERS-- PHYSICAL UNITS OF QUANTITY
C
C  ILUN,ISHOT-- LUN, SHOT NO. NEEDED TO GEN UFILES FILENAME
C  PASS IMOD=1 TO ALLOW USER TO REVISE A SCALAR VALUE UNDER
C  "F" OPTION
C  IF IMOD=1 ILUNC CONTAINS SHOULD BE AN OPEN LUN TO WRITE OUT
C  REMARK THAT SCALAR HAS BEEN MODIFIED
C
C  USER OPTIONS:  LOOK AT ALL SCALARS, FETCH VALUE OF NAMED
C    SCALAR, QUIT
C
C  CALCULATE ALPHABETIC ORDER
C
C *LISMAK* DATA SATEMENT MOVED 12-APR-88
C
C *LISMAK* 12-APR-88  GENERATED LOGICAL DECLARATIONS
      LOGICAL LCHAR,lxout
C *LISMAK* END OF GENERATED LOGICAL DECLARATIONS
C
C => UFSCLK               BEGIN DATA BLOCK
C => LISMAK 12-APR-88  MOVED DATA STATEMENTS
      DATA ZMODL/'          ','/MODIFY   '/
C => END DATA BLOCK
C ====================
C
      luntrm=lnout(0)
C
      CALL UFSCOR(NSC,SCLAB,IORDER)
      CALL UFSNAM(ISHOT,ZFILE,IER,ILUN)
      JMOD=1
      IF(IMOD.EQ.1) JMOD=2
C
C  MENU
C
 10   CONTINUE
      CALL NEUPAG
 11   IF(LXOUT(0)) WRITE(LUNTRM,2000) ZMODL(JMOD)
 2000 FORMAT(/' UFSCLK OPTIONS:'/
     >  ' D - DISPLAY - DISPLAY ALL SCALARS (ON PLOTTING DEVICE)'/
     >  ' F - FETCH   - FETCH',A10,'A SINGLE SCALAR'/
     >  ' Q - QUIT    - EXIT'/
     >  )
      CALL UREAD('UFSCLK:  ENTER OPCODE LETTER (D/F/Q):$')
      IANS=IXUOPC('DFQ$')
      CALL UCHKOP(IANS,0,1,100,-1,*11)
      GO TO (100,200,500) IANS
C  DISPLAY ALL SCALARS ON PLOT DEVICE
 100  CONTINUE
      CALL UFSCPR(ZFILE,SCLAB,SCVAL,IORDER,NSC,0)
      GO TO 10
 200  CONTINUE
C  FETCH A SINGLE SCALAR AND DISPLAY ON TERMINAL
      CALL UFGKEY(ZKEY)
C  SEARCH FOR MATCH IN LIST
      ISC=IUFKEY(ZKEY,SCLAB,NSC)
      IF(ISC.EQ.0) GO TO 290
C  DISPLAY FOUND VALUE
 220  CONTINUE
      WRITE(LUNTRM,2002) SCLAB(1,ISC),SCVAL(ISC),SCLAB(2,ISC),
     >     SCLAB(3,ISC)
 2002 FORMAT(/'  KEYWORD:  ',A10,'  ASSOCIATED VALUE:  ',1PE12.5/
     >          '    LABEL:  ',A10,'    PHYSICAL UNITS:  ',A10/)
      IF(JMOD.EQ.1) CALL UPAUST(1)
      IF(JMOD.EQ.1) GO TO 10
 280  CALL UREAD(
     >'UFSCLK:  ENTER NEW VALUE FOR THIS SCALAR OR "X" NOT TO CHANGE:$')
      IF(LCHAR('X')) GO TO 10
      IF(LCHAR('Q')) GOTO 10
      ZVAL=FDCOD(IERT)
      IF(IERT.NE.0) GO TO 280
      ZVALP=SCVAL(ISC)
      SCVAL(ISC)=ZVAL
      WRITE(ILUNC,7000) SCLAB(1,ISC),ZVALP,ZVAL
 7000 FORMAT(1X,'*** SCALAR "',A10,'" VALUE CHANGED FROM ',1PE11.4,
     >  ' TO ',1PE11.4)
      WRITE(LUNTRM,7000) SCLAB(1,ISC),ZVALP,ZVAL
      CALL UPAUST(0)
      GO TO 10
 290  CONTINUE
      CALL UERMSG('% KEYWORD NOT IN FILE: ',ZKEY,2)
      GO TO 10
C---------
C  QUIT
 500  CONTINUE
      RETURN
      END
C******************** END FILE UFSCLK.FOR ; GROUP UFSCLK ******************
