      SUBROUTINE CSIVAL(NAME,BUFFER,LENGTH,OCTAL,HEX)           !861031 00152 
      IMPLICIT NONE                                                     00156 
      INCLUDE ' 32766 .FID/NOLIST'                                      00156 
      INTEGER*2 MAX_NUM_SW                                              00170 
      INTEGER*2 MAX_NUM_VAL                                             00171 
      PARAMETER (MAX_NUM_SW=20)   !Max number of switches               00173 
      PARAMETER (MAX_NUM_VAL=100) !Max number of switch values          00174 
      INTEGER*4 DEVIND_ADDR     !Address to return device indicies      00176 
      INTEGER*4 EQUAL_ADDR      !Address to return equal status         00177 
      INTEGER*4 FILIND_ADDR     !Address to return file spec indicies   00178 
      INTEGER*2 LINE_POINTER(2) !Position in input line after last      00179 
      INTEGER*4 MORE_ADDR       !Address to return more status          00182 
      INTEGER*4 NODIND_ADDR     !Address to return Node indicies!861031 00183 
      INTEGER*2 NUM_SW_DFN      !Number of switches defined             00184 
      INTEGER*2 NUM_SW_VAL_DFN  !Number of switch values defined        00185 
      BYTE      SW_NAME(2,MAX_NUM_SW) !ASCII switch names               00186 
      INTEGER*4 SW_STATE_ADDR(MAX_NUM_SW) !Addr to return sw status     00187 
      INTEGER*2 SW_STATE_DFLT(MAX_NUM_SW) !Default for sw status        00188 
      INTEGER*4 SW_VALUE_ADDR(MAX_NUM_VAL) !Addr to return sw value     00189 
      INTEGER*2 SW_VALUE_CHAIN(2,MAX_NUM_SW) !Pointers to 1st & last sw 00190 
      INTEGER*2 SW_VALUE_LENGTH(MAX_NUM_VAL)                            00194 
      INTEGER*4 UICIND_ADDR     !Address to return directory indicies   00207 
      INTEGER*4 WILD_ADDR       !Address to return WILD status          00208 
      COMMON/CSI_DATA_BASE__/LINE_POINTER,                              00210 
     1 NUM_SW_DFN,NUM_SW_VAL_DFN,NODIND_ADDR,DEVIND_ADDR,UICIND_ADDR,   00211 
     2 FILIND_ADDR,MORE_ADDR,WILD_ADDR,EQUAL_ADDR,SW_NAME,              00212 
     3 SW_STATE_ADDR,SW_STATE_DFLT,SW_VALUE_ADDR,SW_VALUE_LENGTH,       00213 
     4 SW_VALUE_CHAIN                                                   00214 
      BYTE NAME(2),TST                                                  00220 
      INTEGER*2 BUFFER,LENGTH,OCTAL,NARGS,MAP                           00221 
      INTEGER*2 HEX,RADIX                                       !861031 00222 
      LOGICAL*2 LENP,OCTP,HEXP                          !861031         00223 
      TST=NAME(1).NE.SW_NAME(1,NUM_SW_DFN).OR.NAME(2).NE.SW_NAME(2,     00232 
     1 NUM_SW_DFN)                                                      00233 
      IF(TST)THEN                                                       00234 
      TYPE 1,NAME                                                       00235 
1     FORMAT(' CSIVAL--SWITCH "',2A1,'" NOT YET DEFINED OR',/,          00236 
     1 '        CSIVAL CALL NOT IMMEDIATELY AFTER CORRESPONDING',       00237 
     2 ' CSISW CALL')                                                   00238 
      CALL EXIT !PDP11 CSIVAL FORCES EXIT!                              00239 
      ELSE                                                              00241 
      IF(NUM_SW_VAL_DFN.EQ.MAX_NUM_VAL)THEN                             00245 
      TYPE 2,NAME                                                       00246 
2     FORMAT(' CSIVAL--OUT OF ROOM FOR VALUE FOR SWITCH "',2A1,'"')     00247 
      CALL EXIT !PDP11 CSIVAL FORCES EXIT!                              00248 
      ELSE                                                              00250 
      NUM_SW_VAL_DFN=NUM_SW_VAL_DFN+1                                   00254 
      SW_VALUE_ADDR(NUM_SW_VAL_DFN)=%LOC(BUFFER)                        00255 
      IF(SW_VALUE_CHAIN(1,NUM_SW_DFN) .EQ. 0)THEN                       00256 
      SW_VALUE_CHAIN(1,NUM_SW_DFN) =  NUM_SW_VAL_DFN                    00257 
      ENDIF                                                             00258 
      SW_VALUE_CHAIN(2,NUM_SW_DFN)=NUM_SW_VAL_DFN                       00259 
      CALL ARGS(NARGS,MAP)                                              00263 
      LENP = (NARGS.GE.3) .AND. ((MAP.AND."4).NE.0)             !861031 00264 
      OCTP = (NARGS.GE.4) .AND. ((MAP.AND."10).NE.0)            !861031 00265 
      HEXP = (NARGS.GE.5) .AND. ((MAP.AND."20).NE.0)            !861031 00266 
      IF ((OCTP) .AND. OCTAL.NE.0) THEN                 !861031         00268 
      RADIX = -1                !octal radix                    !861031 00269 
      ELSEIF ((HEXP) .AND. HEX.NE.0) THEN                       !861031 00270 
      RADIX = -2                !hexidecimal                    !861031 00271 
      ELSE                                                      !861031 00272 
      RADIX = 0         !decimal                        !861031         00273 
      ENDIF                                                             00274 
      IF (.NOT.LENP) THEN                                       !861031 00276 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX   !INTEGER*2      !861031 00277 
      ELSEIF (LENGTH.GT.0) THEN                         !861031         00279 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN)=LENGTH    !ASCII string   !861031 00280 
      ELSEIF (LENGTH.EQ.0) THEN                         !861031         00282 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX   !INTEGER*2      !861031 00283 
      ELSEIF (LENGTH.EQ.-1) THEN                                !861031 00285 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX-10        !INTEGER*1!8610300286 
      ELSEIF (LENGTH.EQ.-2) THEN                                !861031 00288 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX-20        !INTEGER*4!8610300289 
      ELSEIF (LENGTH.EQ.-3) THEN                                !861031 00291 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX-30        !REAL*4 !861031 00292 
      ELSEIF (LENGTH.EQ.-4) THEN                                !861031 00294 
      SW_VALUE_LENGTH(NUM_SW_VAL_DFN) = RADIX-40        !REAL*8 !861031 00295 
      ELSE                                                      !861031 00297 
      TYPE 3,NAME                                               !861031 00299 
3     FORMAT(' CSIVAL--Switch"',2A1,'" LENGTH has illegal value')!86103100300 
      CALL EXIT                                         !861031         00301 
      ENDIF                                                     !861031 00302 
      ENDIF                                                             00304 
      ENDIF                                                             00305 
      RETURN                                                            00306 
      END                                                               00307 
