      SUBROUTINE IFS(LOG)
      LOGICAL TOKLAB, ERR, SYSERR, ABORT, LOG
      INTEGER STMT, PSTMT, EXPR
      COMMON /INPUT/ NSTMT, PSTMT, STMT(1327)
      COMMON /DETECT/ ERR, SYSERR, ABORT
C
C     ROUTINE PROCESSES ARITHMETIC AND LOGICAL IF STMTS
C     LOG RETURNED AS TRUE IF LOGICAL-IF IS ENCOUNTERED;PU CHECKS FOR
C     ACCEPTIBLE EXECUTABLE STMT AFTER LOGICAL EXPRESSION
C
      LOG = .FALSE.
      L = MOD(EXPR(I),8)
      IF (-1.EQ.L .OR. SYSERR) GO TO 30
      LOG = L.EQ.4
      IF (LOG) GO TO 30
C
C     ARITHMETIC IF--SEARCH FOR  <LAB>,<LAB>,<LAB>
C
      IF (L.GT.2) GO TO 50
      I = 0
      IF (PSTMT.GE.NSTMT) GO TO 20
   10 IF (.NOT.TOKLAB(1,K2,L,.FALSE.)) GO TO 40
      IF (SYSERR) GO TO 30
      I = I + 1
      IF (I.EQ.3) GO TO 60
      IF (STMT(K2).NE.68) GO TO 20
      PSTMT = K2 + 1
      IF (PSTMT.LT.NSTMT) GO TO 10
   20 CALL ERROR1(15H ILLEGAL SYNTAX, 15)
   30 RETURN
   40 CALL ERROR1(14H MISSING LABEL, 14)
      GO TO 30
   50 CALL ERROR1(39H COMPLEX EXPRESSION ILLEGAL IN ARITH-IF, 39)
      GO TO 30
   60 IF (K2.EQ.NSTMT) GO TO 30
      CALL ERROR1(34H EXTRANEOUS INFO AFTER END OF STMT, 34)
      GO TO 30
      END
