      INTEGER RD(884)
      INTEGER ROW(500),RPN(200),CBUF(500)
      INTEGER GETARG,LOADRD,GETROW,ISATTY,EVAL,PARSE
      INTEGER ARG(128)
      IF((LOADRD(RD,-10).EQ.-2))GOTO 10000
        CALL ERROR('Cannot load input relation.')
10000 IF((GETARG(2,ARG,128).NE.-1))GOTO 10002
      IF((GETARG(1,ARG,128).EQ.-1))GOTO 10002
      GOTO 10001
10002   CALL ERROR('Usage: rdsel <selection expr>.')
10001 IF((PARSE(RD,0,ARG,RPN,CBUF).EQ.-2))GOTO 10003
        CALL SWT
10003 CALL SAVERD(RD,-11)
      IF((ISATTY(-11).NE.1))GOTO 10004
        CALL PRINT0(RD,-11)
10004 CONTINUE
10005 IF((GETROW(RD,-10,ROW).EQ.-1))GOTO 10006
        IF((EVAL(RD,ROW,RPN,CBUF).NE.1))GOTO 10007
          CALL PUTROW(RD,-11,ROW)
10007 GOTO 10005
10006 IF((ISATTY(-11).NE.1))GOTO 10008
        CALL PRINU0(RD,-11)
10008 CALL SWT
      END
      INTEGER FUNCTION PARSE(RD,POS2,ARG,RPN,CBUF)
      INTEGER RD(884)
      INTEGER POS2
      INTEGER ARG(1)
      INTEGER RPN(200),CBUF(500)
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER AAAAA0(19)
      DATA AAAAA0/201,238,246,225,236,233,228,160,229,248,240,242,229,24
     *3,243,233,239,238,0/
      CALL MKLB$F($1,ERRLA0)
      CALL MOVE$(RD,RDAAA0,RD(1))
      POS2A0=POS2
      CALL CTOC(ARG,ARGAA0,128)
      APAAA0=1
      RPNLE0=1
      CBUFL0=1
      CALL GETSYM
      CALL EXPR
      IF((ARGAA0(APAAA0).EQ.0))GOTO 10009
        CALL PSYNER(AAAAA0,1)
10009 CALL PUSH(0)
      CALL MOVE$(RPNAA0,RPN,RPNLE0)
      CALL MOVE$(CBUFA0,CBUF,CBUFL0)
      PARSE=-2
      RETURN
1     PARSE=-3
      RETURN
      END
      SUBROUTINE EXPR
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      CALL TERM
10010 IF((SYMTY0.NE.252))GOTO 10011
        CALL GETSYM
        CALL TERM
        CALL PUSH(252)
      GOTO 10010
10011 RETURN
      END
      SUBROUTINE TERM
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      CALL FACTOR
10012 IF((SYMTY0.NE.166))GOTO 10013
        CALL GETSYM
        CALL FACTOR
        CALL PUSH(166)
      GOTO 10012
10013 RETURN
      END
      SUBROUTINE FACTOR
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      IF((SYMTY0.NE.254))GOTO 10014
        CALL GETSYM
        CALL FACTOR
        CALL PUSH(254)
        GOTO 10015
10014   CALL PRIMA0
10015 RETURN
      END
      SUBROUTINE PRIMA0
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER FT1,FT2,P1,P2,OP,TYPE1,TYPE2
      INTEGER GETQU0,CONVE0
      INTEGER S1(102),S2(102)
      INTEGER AAAAB0(23)
      INTEGER AAAAC0(28)
      INTEGER AAAAD0
      INTEGER AAAAE0
      INTEGER AAAAF0
      INTEGER AAAAG0(33)
      INTEGER AAAAH0
      INTEGER AAAAI0(33)
      INTEGER AAAAJ0(40)
      DATA AAAAB0/245,238,226,225,236,225,238,227,229,228,160,240,225,24
     *2,229,238,244,232,229,243,229,243,0/
      DATA AAAAC0/237,233,243,243,233,238,231,160,242,229,236,225,244,23
     *3,239,238,225,236,160,239,240,229,242,225,244,239,242,0/
      DATA AAAAG0/195,239,237,240,225,242,233,238,231,160,244,247,239,16
     *0,236,233,244,229,242,225,236,243,160,233,243,160,226,239,231,245,
     *243,161,0/
      DATA AAAAI0/195,239,237,240,225,242,233,238,231,160,244,247,239,16
     *0,236,233,244,229,242,225,236,243,160,233,243,160,226,239,231,245,
     *243,161,0/
      DATA AAAAJ0/244,249,240,229,243,160,244,239,160,226,229,160,227,23
     *9,237,240,225,242,229,228,160,225,242,229,160,238,239,244,160,227,
     *239,237,240,225,244,233,226,236,229,0/
      IF((SYMTY0.NE.168))GOTO 10016
        CALL GETSYM
        CALL EXPR
        IF((SYMTY0.EQ.169))GOTO 10017
          CALL PSYNER(AAAAB0,1)
10017   CALL GETSYM
        GOTO 10018
10016   CALL FIELD(FT1,S1)
        IF((SYMTY0.EQ.188))GOTO 10019
        IF((SYMTY0.EQ.190))GOTO 10019
        IF((SYMTY0.EQ.220))GOTO 10019
        IF((SYMTY0.EQ.175))GOTO 10019
        IF((SYMTY0.EQ.222))GOTO 10019
        IF((SYMTY0.EQ.189))GOTO 10019
          CALL PSYNER(AAAAC0,1)
10019   OP=SYMTY0
        CALL GETSYM
        CALL FIELD(FT2,S2)
        TYPE1=3
        TYPE2=3
        AAAAD0=FT1
        GOTO 10020
10021     P1=GETQU0(S1)
          TYPE1=RDAAA0(P1)
          AAAAE0=FT2
          GOTO 10022
10023       P2=GETQU0(S2)
            TYPE2=RDAAA0(P2)
          GOTO 10024
10025       P2=CONVE0(S2,TYPE1)
            TYPE2=TYPE1
          GOTO 10024
10026       TYPE2=3
            P2=CONVE0(S2,3)
          GOTO 10024
10022     IF(AAAAE0.EQ.162)GOTO 10026
          IF(AAAAE0.EQ.176)GOTO 10025
          IF(AAAAE0.EQ.193)GOTO 10023
10024   GOTO 10027
10028     AAAAF0=FT2
          GOTO 10029
10030       P2=GETQU0(S2)
            TYPE2=RDAAA0(P2)
            TYPE1=RDAAA0(P2)
            P1=CONVE0(S1,TYPE1)
          GOTO 10031
10032       CALL PSYNER(AAAAG0,1)
          GOTO 10031
10029     IF(AAAAF0.EQ.162)GOTO 10032
          IF(AAAAF0.EQ.176)GOTO 10032
          IF(AAAAF0.EQ.193)GOTO 10030
10031   GOTO 10027
10033     TYPE1=3
          P1=CONVE0(S1,3)
          AAAAH0=FT2
          GOTO 10034
10035       P2=GETQU0(S2)
            TYPE2=RDAAA0(P2)
          GOTO 10036
10037       CALL PSYNER(AAAAI0,1)
          GOTO 10036
10034     IF(AAAAH0.EQ.162)GOTO 10037
          IF(AAAAH0.EQ.176)GOTO 10037
          IF(AAAAH0.EQ.193)GOTO 10035
10036   GOTO 10027
10020   IF(AAAAD0.EQ.162)GOTO 10033
        IF(AAAAD0.EQ.176)GOTO 10028
        IF(AAAAD0.EQ.193)GOTO 10021
10027   IF((TYPE1.EQ.TYPE2))GOTO 10038
          CALL PSYNER(AAAAJ0,1)
10038   CALL PUSH(OP)
        CALL PUSH(FT1)
        CALL PUSH(P1)
        CALL PUSH(FT2)
        CALL PUSH(P2)
10018 RETURN
      END
      SUBROUTINE FIELD(FT,S)
      INTEGER FT
      INTEGER S(102)
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER AAAAK0(32)
      DATA AAAAK0/229,248,240,229,227,244,229,228,160,228,239,237,225,23
     *3,238,160,238,225,237,229,160,239,242,160,236,233,244,229,242,225,
     *236,0/
      IF((SYMTY0.EQ.193))GOTO 10039
      IF((SYMTY0.EQ.176))GOTO 10039
      IF((SYMTY0.EQ.162))GOTO 10039
        CALL PSYNER(AAAAK0,1)
10039 FT=SYMTY0
      CALL CTOC(SYMTE0,S,102)
      CALL GETSYM
      RETURN
      END
      INTEGER FUNCTION GETQU0(NAME)
      INTEGER NAME(1)
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER I
      INTEGER FINDQ0
      INTEGER AAAAL0(32)
      DATA AAAAL0/186,160,228,239,237,225,233,238,160,238,239,244,160,23
     *0,239,245,238,228,160,239,242,160,225,237,226,233,231,245,239,245,
     *243,0/
      I=FINDQ0(RDAAA0,NAME,POS2A0)
      IF((I.NE.0))GOTO 10040
        CALL PRINT(-15,'*s.',NAME)
        CALL PSYNER(AAAAL0,0)
10040 GETQU0=I
      RETURN
      END
      INTEGER FUNCTION FINDQ0(RD,NAME,POS2)
      INTEGER RD(884)
      INTEGER NAME(1)
      INTEGER POS2
      INTEGER P,I
      INTEGER EQUAL
      INTEGER RNAME(17)
      INTEGER AAAAM0(3)
      INTEGER AAAAN0(3)
      DATA AAAAM0/174,177,0/
      DATA AAAAN0/174,178,0/
      I=1
      GOTO 10043
10041 I=I+(1)
10043 IF((NAME(I).EQ.0))GOTO 10042
      IF((NAME(I).EQ.174))GOTO 10042
      IF((I.GE.17))GOTO 10042
        RNAME(I)=NAME(I)
      GOTO 10041
10042 RNAME(I)=0
      P=0
      IF((NAME(I).EQ.0))GOTO 10045
      IF((POS2.EQ.0))GOTO 10045
      GOTO 10044
10045   I=3+1
        GOTO 10048
10046   I=I+22
10048   IF((I.GT.RD(2)))GOTO 10047
          IF((EQUAL(RNAME,RD(I+5)).NE.1))GOTO 10049
            IF((P.NE.0))GOTO 10050
              P=I
              GOTO 10051
10050         P=0
              GOTO 10047
10051     CONTINUE
10049   GOTO 10046
10047   GOTO 10052
10044   IF((EQUAL(NAME(I),AAAAM0).NE.1))GOTO 10053
          I=3+1
          GOTO 10056
10054     I=I+22
10056     IF((I.EQ.POS2))GOTO 10055
            IF((EQUAL(RNAME,RD(I+5)).NE.1))GOTO 10057
              P=I
              GOTO 10055
10057     GOTO 10054
10055     GOTO 10058
10053     IF((EQUAL(NAME(I),AAAAN0).NE.1))GOTO 10059
            I=POS2
            GOTO 10062
10060       I=I+22
10062       IF((I.GT.RD(2)))GOTO 10061
              IF((EQUAL(RNAME,RD(I+5)).NE.1))GOTO 10063
                P=I
                GOTO 10061
10063       GOTO 10060
10061     CONTINUE
10059   CONTINUE
10058 CONTINUE
10052 FINDQ0=P
      RETURN
      END
      INTEGER FUNCTION CONVE0(S,TYPE)
      INTEGER S(1)
      INTEGER TYPE,P
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER I,P
      INTEGER LENGTH
      INTEGER * 4 L
      INTEGER * 4 GCTOL
      REAL * 8 D
      REAL * 8 CTOD
      INTEGER AAAAO0
      INTEGER AAAAP0(18)
      INTEGER AAAAQ0(3)
      INTEGER AAAAR0(25)
      INTEGER AAAAS0(18)
      INTEGER AAAAT0(3)
      INTEGER AAAAU0(22)
      INTEGER AAAAV0(18)
      DATA AAAAP0/212,239,239,160,237,225,238,249,160,236,233,244,229,24
     *2,225,236,243,0/
      DATA AAAAQ0/170,243,0/
      DATA AAAAR0/201,238,246,225,236,233,228,160,233,238,244,229,231,22
     *9,242,160,227,239,238,243,244,225,238,244,0/
      DATA AAAAS0/212,239,239,160,237,225,238,249,160,236,233,244,229,24
     *2,225,236,243,0/
      DATA AAAAT0/170,243,0/
      DATA AAAAU0/201,238,246,225,236,233,228,160,242,229,225,236,160,22
     *7,239,238,243,244,225,238,244,0/
      DATA AAAAV0/212,239,239,160,237,225,238,249,160,236,233,244,229,24
     *2,225,236,243,0/
      P=CBUFL0
      AAAAO0=TYPE
      GOTO 10064
10065   CBUFL0=CBUFL0+(2)
        IF((CBUFL0.LE.500))GOTO 10066
          CALL PSYNER(AAAAP0,1)
10066   I=1
        L=GCTOL(S,I,10)
        IF((S(I).EQ.0))GOTO 10067
          CALL PRINT(-15,AAAAQ0,S)
          CALL PSYNER(AAAAR0,0)
10067   CALL MOVE$(L,CBUFA0(P),2)
      GOTO 10068
10069   CBUFL0=CBUFL0+(4)
        IF((CBUFL0.LE.500))GOTO 10070
          CALL PSYNER(AAAAS0,1)
10070   I=1
        D=CTOD(S,I)
        IF((S(I).EQ.0))GOTO 10071
          CALL PRINT(-15,AAAAT0,S)
          CALL PSYNER(AAAAU0,0)
10071   CALL MOVE$(D,CBUFA0(P),4)
      GOTO 10068
10072   I=LENGTH(S)+1
        CBUFL0=CBUFL0+(I)
        IF((CBUFL0.LE.500))GOTO 10073
          CALL PSYNER(AAAAV0,1)
10073   CALL MOVE$(S,CBUFA0(P),I)
      GOTO 10068
10064 GOTO(10065,10069,10072),AAAAO0
10068 CONVE0=P
      RETURN
      END
      SUBROUTINE GETSYM
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER L
      INTEGER QUOTE
      INTEGER AAAAW0
      INTEGER AAAAX0(14)
      INTEGER AAAAY0
      INTEGER AAAAZ0
      INTEGER AAABA0
      INTEGER AAABB0
      INTEGER AAABC0
      INTEGER AAABD0
      INTEGER AAABE0
      INTEGER AAABF0(18)
      DATA AAAAX0/205,233,243,243,233,238,231,160,241,245,239,244,229,0/
      DATA AAABF0/201,236,236,229,231,225,236,160,227,232,225,242,225,22
     *7,244,229,242,0/
10074 IF((ARGAA0(APAAA0).NE.160))GOTO 10075
        APAAA0=APAAA0+(1)
      GOTO 10074
10075 L=1
      AAAAW0=ARGAA0(APAAA0)
      GOTO 10076
10077   SYMTE0(L)=ARGAA0(APAAA0)
        APAAA0=APAAA0+(1)
        L=L+(1)
        GOTO 10080
10078   APAAA0=APAAA0+(1)
        L=L+(1)
10080   IF((193.GT.ARGAA0(APAAA0)))GOTO 10082
        IF((ARGAA0(APAAA0).GT.218))GOTO 10082
        GOTO 10081
10082   IF((225.GT.ARGAA0(APAAA0)))GOTO 10083
        IF((ARGAA0(APAAA0).GT.250))GOTO 10083
        GOTO 10081
10083   IF((176.GT.ARGAA0(APAAA0)))GOTO 10084
        IF((ARGAA0(APAAA0).GT.185))GOTO 10084
        GOTO 10081
10084   IF((ARGAA0(APAAA0).EQ.223))GOTO 10081
        IF((ARGAA0(APAAA0).EQ.174))GOTO 10081
        GOTO 10079
10081     SYMTE0(L)=ARGAA0(APAAA0)
        GOTO 10078
10079   SYMTY0=193
      GOTO 10085
10086   SYMTE0(L)=ARGAA0(APAAA0)
        APAAA0=APAAA0+(1)
        L=L+(1)
        GOTO 10089
10087   APAAA0=APAAA0+(1)
        L=L+(1)
10089   IF((176.GT.ARGAA0(APAAA0)))GOTO 10091
        IF((ARGAA0(APAAA0).GT.185))GOTO 10091
        GOTO 10090
10091   IF((ARGAA0(APAAA0).EQ.174))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.171))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.173))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.229))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.197))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.242))GOTO 10090
        IF((ARGAA0(APAAA0).EQ.210))GOTO 10090
        GOTO 10088
10090     SYMTE0(L)=ARGAA0(APAAA0)
        GOTO 10087
10088   SYMTY0=176
      GOTO 10085
10092   QUOTE=ARGAA0(APAAA0)
        APAAA0=APAAA0+(1)
        L=1
        GOTO 10095
10093   APAAA0=APAAA0+(1)
        L=L+(1)
10095   IF((ARGAA0(APAAA0).EQ.0))GOTO 10094
        IF((ARGAA0(APAAA0).EQ.QUOTE))GOTO 10094
          SYMTE0(L)=ARGAA0(APAAA0)
        GOTO 10093
10094   SYMTE0(L)=0
        IF((ARGAA0(APAAA0).NE.0))GOTO 10096
          CALL PSYNER(AAAAX0,1)
          GOTO 10097
10096     APAAA0=APAAA0+(1)
10097   SYMTY0=162
      GOTO 10085
10098   SYMTY0=ARGAA0(APAAA0)
        SYMTE0(1)=ARGAA0(APAAA0)
        APAAA0=APAAA0+(1)
        L=L+(1)
      GOTO 10085
10099   SYMTE0(1)=188
        APAAA0=APAAA0+(1)
        L=L+(1)
        AAAAY0=ARGAA0(APAAA0)
        GOTO 10100
10101     SYMTY0=222
        GOTO 10102
10103     SYMTY0=175
        GOTO 10102
10102     SYMTE0(2)=ARGAA0(APAAA0)
          APAAA0=APAAA0+(1)
          L=L+(1)
        GOTO 10104
10100   AAAAZ0=AAAAY0-188
        GOTO(10103,10101),AAAAZ0
          SYMTY0=188
10104 GOTO 10085
10105   SYMTE0(1)=190
        APAAA0=APAAA0+(1)
        L=L+(1)
        AAABA0=ARGAA0(APAAA0)
        GOTO 10106
10107     SYMTY0=222
        GOTO 10108
10109     SYMTY0=220
        GOTO 10108
10108     SYMTE0(2)=ARGAA0(APAAA0)
          APAAA0=APAAA0+(1)
          L=L+(1)
        GOTO 10110
10106   AAABB0=AAABA0-187
        GOTO(10107,10109),AAABB0
          SYMTY0=190
10110 GOTO 10085
10111   SYMTE0(1)=189
        APAAA0=APAAA0+(1)
        L=L+(1)
        AAABC0=ARGAA0(APAAA0)
        GOTO 10112
10113     SYMTY0=189
        GOTO 10114
10115     SYMTY0=220
        GOTO 10114
10116     SYMTY0=175
        GOTO 10114
10114     SYMTE0(2)=ARGAA0(APAAA0)
          APAAA0=APAAA0+(1)
          L=L+(1)
        GOTO 10117
10112   AAABD0=AAABC0-187
        GOTO(10116,10113,10115),AAABD0
          SYMTY0=189
10117 GOTO 10085
10118   SYMTE0(1)=254
        APAAA0=APAAA0+(1)
        L=L+(1)
        IF((ARGAA0(APAAA0).NE.189))GOTO 10119
          SYMTY0=222
          SYMTE0(2)=189
          APAAA0=APAAA0+(1)
          L=L+(1)
          GOTO 10120
10119     SYMTY0=254
10120 GOTO 10085
10121   SYMTY0=0
      GOTO 10085
10076 IF(AAAAW0.EQ.0)GOTO 10121
      AAABE0=AAAAW0-161
      GOTO(10092,10122,10122,10122,10098,10092,10098,10098,10122,10086,1
     *0122,10086,10098,10122,10086,10086,10086,10086,10086,10086,10086,1
     *0086,10086,10086,10122,10122,10099,10111,10105,10122,10122,10077,1
     *0077,10077,10077,10077,10077,10077,10077,10077,10077,10077,10077,1
     *0077,10077,10077,10077,10077,10077,10077,10077,10077,10077,10077,1
     *0077,10077,10077,10122,10122,10122,10122,10122,10122,10077,10077,1
     *0077,10077,10077,10077,10077,10077,10077,10077,10077,10077,10077,1
     *0077,10077,10077,10077,10077,10077,10077,10077,10077,10077,10077,1
     *0077,10077,10122,10098,10122,10118),AAABE0
10122   CALL PSYNER(AAABF0,1)
10085 SYMTE0(L)=0
      RETURN
      END
      SUBROUTINE PUSH(W)
      INTEGER W
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER AAABG0(37)
      DATA AAABG0/211,229,236,229,227,244,233,239,238,160,229,248,240,24
     *2,229,243,243,233,239,238,160,244,239,239,160,227,239,237,240,236,
     *233,227,225,244,229,228,0/
      IF((RPNLE0.LT.200))GOTO 10123
        CALL PSYNER(AAABG0,1)
        GOTO 10124
10123   RPNAA0(RPNLE0)=W
        RPNLE0=RPNLE0+(1)
10124 RETURN
      END
      SUBROUTINE PSYNER(M,C)
      INTEGER M(1)
      INTEGER C
      INTEGER RDAAA0(884)
      INTEGER ARGAA0(128)
      INTEGER APAAA0,POS2A0
      INTEGER RPNAA0(200),RPNLE0
      INTEGER SYMTY0,SYMTE0(128)
      INTEGER CBUFA0(500),CBUFL0
      REAL * 8 ERRLA0
      COMMON /RSLCOM/RDAAA0,ARGAA0,APAAA0,RPNAA0,RPNLE0,SYMTY0,SYMTE0,CB
     *UFA0,CBUFL0,ERRLA0,POS2A0
      INTEGER AAABH0(15)
      INTEGER AAABI0(5)
      DATA AAABH0/170,243,186,160,170,243,170,238,170,163,248,222,170,23
     *8,0/
      DATA AAABI0/170,243,170,238,0/
      IF((C.NE.1))GOTO 10125
        CALL PRINT(-15,AAABH0,ARGAA0,M,APAAA0-2)
        GOTO 10126
10125   CALL PRINT(-15,AAABI0,M)
10126 CALL PL1$NL(ERRLA0)
      END
      INTEGER FUNCTION EVAL(RD,ROW,RPN,CBUF)
      INTEGER RD(884)
      INTEGER ROW(1),RPN(1),CBUF(500)
      INTEGER SP,RP,I1,I2,R
      INTEGER BUF1(102),BUF2(102),STACK(200)
      INTEGER EVALR0
      INTEGER P1,P2
      INTEGER AAABJ0
      INTEGER AAABK0
      INTEGER AAABL0(30)
      DATA AAABL0/233,238,160,229,246,225,236,186,160,243,244,225,227,23
     *5,160,237,229,243,243,229,228,160,245,240,160,170,233,170,238,0/
      SP=0
      RP=1
      GOTO 10129
10127 RP=RP+(1)
10129 IF((RPN(RP).EQ.0))GOTO 10128
        AAABJ0=RPN(RP)
        GOTO 10130
10131     IF((STACK(SP).NE.1))GOTO 10132
          IF((STACK(SP-1).NE.1))GOTO 10132
            STACK(SP-1)=1
            GOTO 10133
10132       STACK(SP-1)=0
10133     SP=SP-(1)
        GOTO 10134
10135     IF((STACK(SP).EQ.1))GOTO 10137
          IF((STACK(SP-1).EQ.1))GOTO 10137
          GOTO 10136
10137       STACK(SP-1)=1
            GOTO 10138
10136       STACK(SP-1)=0
10138     SP=SP-(1)
        GOTO 10134
10139     IF((STACK(SP).NE.1))GOTO 10140
            STACK(SP)=0
            GOTO 10141
10140       STACK(SP)=1
10141   GOTO 10134
10130   IF(AAABJ0.EQ.166)GOTO 10131
        AAABK0=AAABJ0-251
        GOTO(10135,10142,10139),AAABK0
10142     I1=RPN(RP+1)
          P1=RPN(RP+2)
          I2=RPN(RP+3)
          P2=RPN(RP+4)
          IF((I1.NE.193))GOTO 10143
          IF((I2.NE.193))GOTO 10143
            CALL GETDA0(RD,P1,ROW,BUF1)
            CALL GETDA0(RD,P2,ROW,BUF2)
            R=EVALR0(RPN(RP),RD(P1),BUF1,BUF2)
            GOTO 10144
10143       IF((I1.NE.193))GOTO 10145
              CALL GETDA0(RD,P1,ROW,BUF1)
              R=EVALR0(RPN(RP),RD(P1),BUF1,CBUF(P2))
              GOTO 10146
10145         IF((I2.NE.193))GOTO 10147
                CALL GETDA0(RD,P2,ROW,BUF2)
                R=EVALR0(RPN(RP),RD(P2),CBUF(P1),BUF2)
                GOTO 10148
10147           R=EVALR0(RPN(RP),0,CBUF(P1),CBUF(P2))
10148       CONTINUE
10146     CONTINUE
10144     SP=SP+(1)
          STACK(SP)=R
          RP=RP+(4)
10134 GOTO 10127
10128 IF((SP.EQ.1))GOTO 10149
        CALL PRINT(-15,AAABL0,SP)
10149 EVAL=STACK(1)
      RETURN
      END
      INTEGER FUNCTION EVALR0(OP,TYPE,BUF1,BUF2)
      INTEGER OP,TYPE,BUF1(1),BUF2(1)
      INTEGER R
      INTEGER COMPA0
      INTEGER AAABM0
      INTEGER AAABN0
      INTEGER AAABO0(30)
      DATA AAABO0/233,238,160,229,246,225,236,223,242,229,236,186,160,22
     *6,239,231,245,243,160,229,238,244,242,249,160,170,233,170,238,0/
      AAABM0=OP
      GOTO 10150
10151   IF((COMPA0(TYPE,BUF1,BUF2).NE.1))GOTO 10152
          R=1
          GOTO 10153
10152     R=0
10153 GOTO 10154
10155   IF((COMPA0(TYPE,BUF1,BUF2).NE.2))GOTO 10156
          R=1
          GOTO 10157
10156     R=0
10157 GOTO 10154
10158   IF((COMPA0(TYPE,BUF1,BUF2).NE.3))GOTO 10159
          R=1
          GOTO 10160
10159     R=0
10160 GOTO 10154
10161   IF((COMPA0(TYPE,BUF1,BUF2).EQ.3))GOTO 10162
          R=1
          GOTO 10163
10162     R=0
10163 GOTO 10154
10164   IF((COMPA0(TYPE,BUF1,BUF2).EQ.2))GOTO 10165
          R=1
          GOTO 10166
10165     R=0
10166 GOTO 10154
10167   IF((COMPA0(TYPE,BUF1,BUF2).EQ.1))GOTO 10168
          R=1
          GOTO 10169
10168     R=0
10169 GOTO 10154
10150 IF(AAABM0.EQ.175)GOTO 10161
      AAABN0=AAABM0-187
      GOTO(10151,10155,10158),AAABN0
      AAABN0=AAABM0-219
      GOTO(10167,10170,10164),AAABN0
10170   CALL PRINT(-15,AAABO0,OP)
10154 EVALR0=R
      RETURN
      END
      INTEGER FUNCTION LOADRD(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER ISATTY,READF
      IF((ISATTY(FD).NE.1))GOTO 10171
        CALL REMARK('Sorry, a relation can''t be read from the terminal.
     *')
        LOADRD=-3
        RETURN
10171 IF((READF(RD(1),1,FD).NE.-1))GOTO 10172
        LOADRD=-3
        RETURN
10172 IF((READF(RD(2),RD(1)-1,FD).NE.-1))GOTO 10173
        CALL REMARK('relation is corrupted!!.')
        LOADRD=-3
        RETURN
10173 LOADRD=-2
      RETURN
      END
      SUBROUTINE SAVERD(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER ISATTY
      IF((ISATTY(FD).NE.1))GOTO 10174
        CALL PRINV0(RD,FD)
        GOTO 10175
10174   CALL WRITEF(RD,RD(1),FD)
10175 RETURN
      END
      SUBROUTINE PRINV0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER TYPE(102)
      INTEGER AAABP0(10)
      INTEGER AAABQ0(33)
      INTEGER AAABR0(10)
      INTEGER AAABS0
      INTEGER AAABT0(8)
      INTEGER AAABU0(5)
      INTEGER AAABV0(7)
      INTEGER AAABW0(24)
      INTEGER AAABX0(10)
      DATA AAABP0/170,179,185,172,172,173,248,170,238,0/
      DATA AAABQ0/252,160,244,249,240,229,160,160,160,160,252,160,236,22
     *9,238,231,244,232,160,252,160,238,225,237,229,170,177,179,248,252,
     *170,238,0/
      DATA AAABR0/170,179,185,172,172,173,248,170,238,0/
      DATA AAABT0/233,238,244,229,231,229,242,0/
      DATA AAABU0/242,229,225,236,0/
      DATA AAABV0/243,244,242,233,238,231,0/
      DATA AAABW0/252,160,170,183,243,160,252,160,170,181,233,160,160,25
     *2,160,170,177,182,243,160,252,170,238,0/
      DATA AAABX0/170,179,185,172,172,173,248,170,238,0/
      CALL PRINT(FD,AAABP0)
      CALL PRINT(FD,AAABQ0)
      CALL PRINT(FD,AAABR0)
      I=3+1
      GOTO 10178
10176 I=I+22
10178 IF((I.GT.RD(2)))GOTO 10177
        AAABS0=RD(I)
        GOTO 10179
10180     CALL CTOC(AAABT0,TYPE,102)
        GOTO 10181
10182     CALL CTOC(AAABU0,TYPE,102)
        GOTO 10181
10183     CALL CTOC(AAABV0,TYPE,102)
        GOTO 10181
10179   GOTO(10180,10182,10183),AAABS0
10181   CALL PRINT(FD,AAABW0,TYPE,RD(I+1),RD(I+5))
      GOTO 10176
10177 CALL PRINT(FD,AAABX0)
      RETURN
      END
      INTEGER FUNCTION ADDFI0(RD,TYPE,LEN,NAME)
      INTEGER RD(884)
      INTEGER TYPE,LEN
      INTEGER NAME(1)
      INTEGER I
      INTEGER AAABY0
      I=RD(2)+22
      IF((I+22-1.LE.884))GOTO 10184
        ADDFI0=0
        RETURN
10184 RD(I)=TYPE
      RD(I+4)=LENGTH(NAME)
      AAABY0=TYPE
      GOTO 10185
10186   RD(I+1)=2
        RD(I+4)=MAX0(RD(I+4),10)
      GOTO 10187
10188   RD(I+1)=4
        RD(I+4)=MAX0(RD(I+4),15)
      GOTO 10187
10189   RD(I+1)=LEN
        RD(I+4)=MAX0(RD(I+4),LEN)
      GOTO 10187
10185 GOTO(10186,10188,10189),AAABY0
        CALL ERROR('in add_field_to_rd: bogus type passed.')
10187 RD(I+2)=RD(3)+1
      RD(I+3)=RD(3)+RD(I+1)
      CALL CTOC(NAME,RD(I+5),17)
      RD(1)=RD(1)+(22)
      RD(2)=RD(2)+(22)
      RD(3)=RD(3)+(RD(I+1))
      IF((RD(3).LE.500))GOTO 10190
        ADDFI0=0
        RETURN
10190 ADDFI0=I
      RETURN
      END
      INTEGER FUNCTION FINDF0(RD,NAME)
      INTEGER RD(884)
      INTEGER NAME(1)
      INTEGER I
      INTEGER EQUAL
      I=3+1
      GOTO 10193
10191 I=I+22
10193 IF((I.GT.RD(2)))GOTO 10192
        IF((EQUAL(RD(I+5),NAME).NE.1))GOTO 10194
          FINDF0=I
          RETURN
10194 GOTO 10191
10192 FINDF0=0
      RETURN
      END
      INTEGER FUNCTION COMPA0(TYPE,BUF1,BUF2)
      INTEGER TYPE
      INTEGER BUF1(500),BUF2(500)
      INTEGER R
      INTEGER COMPB0,COMPC0,COMPD0
      INTEGER AAABZ0
      INTEGER AAACA0(34)
      DATA AAACA0/233,238,160,227,239,237,240,225,242,229,223,230,233,22
     *9,236,228,186,160,226,239,231,245,243,160,244,249,240,229,160,170,
     *233,170,238,0/
      AAABZ0=TYPE
      GOTO 10195
10196   R=COMPB0(BUF1,BUF2)
      GOTO 10197
10198   R=COMPC0(BUF1,BUF2)
      GOTO 10197
10199   R=COMPD0(BUF1,BUF2)
      GOTO 10197
10195 GOTO(10196,10198,10199),AAABZ0
        CALL PRINT(-15,AAACA0,TYPE)
        R=2
10197 COMPA0=R
      RETURN
      END
      INTEGER FUNCTION COMPB0(I1,I2)
      INTEGER * 4 I1,I2
      IF((I1.GE.I2))GOTO 10200
        COMPB0=1
        RETURN
10200 IF((I1.LE.I2))GOTO 10201
        COMPB0=3
        RETURN
10201 COMPB0=2
      RETURN
      END
      INTEGER FUNCTION COMPC0(D1,D2)
      REAL * 8 D1,D2
      IF((D1.GE.D2))GOTO 10202
        COMPC0=1
        RETURN
10202 IF((D1.LE.D2))GOTO 10203
        COMPC0=3
        RETURN
10203 COMPC0=2
      RETURN
      END
      INTEGER FUNCTION COMPD0(S1,S2)
      INTEGER S1(1),S2(1)
      INTEGER I
      I=1
      GOTO 10206
10204 I=I+(1)
10206 IF((S1(I).NE.S2(I)))GOTO 10205
      IF((S1(I).EQ.0))GOTO 10205
      GOTO 10204
10205 IF((S1(I).NE.S2(I)))GOTO 10207
        COMPD0=2
        RETURN
10207 IF((S1(I).EQ.0))GOTO 10209
      IF((S1(I).LT.S2(I)))GOTO 10209
      GOTO 10208
10209   COMPD0=1
        RETURN
10208 COMPD0=3
      RETURN
      END
      SUBROUTINE PRINT0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER AAACB0(2)
      INTEGER AAACC0(7)
      INTEGER AAACD0(3)
      INTEGER AAACE0(2)
      INTEGER AAACF0(7)
      INTEGER AAACG0(3)
      INTEGER AAACH0(2)
      INTEGER AAACI0(7)
      INTEGER AAACJ0(3)
      DATA AAACB0/173,0/
      DATA AAACC0/170,163,172,172,173,248,0/
      DATA AAACD0/170,238,0/
      DATA AAACE0/252,0/
      DATA AAACF0/160,170,163,243,160,252,0/
      DATA AAACG0/170,238,0/
      DATA AAACH0/173,0/
      DATA AAACI0/170,163,172,172,173,248,0/
      DATA AAACJ0/170,238,0/
      CALL PRINT(FD,AAACB0)
      I=3+1
      GOTO 10212
10210 I=I+22
10212 IF((I.GT.RD(2)))GOTO 10211
        CALL PRINT(FD,AAACC0,RD(I+4)+3)
      GOTO 10210
10211 CALL PRINT(FD,AAACD0)
      CALL PRINT(FD,AAACE0)
      I=3+1
      GOTO 10215
10213 I=I+22
10215 IF((I.GT.RD(2)))GOTO 10214
        CALL PRINT(FD,AAACF0,RD(I+4),RD(I+5))
      GOTO 10213
10214 CALL PRINT(FD,AAACG0)
      CALL PRINT(FD,AAACH0)
      I=3+1
      GOTO 10218
10216 I=I+22
10218 IF((I.GT.RD(2)))GOTO 10217
        CALL PRINT(FD,AAACI0,RD(I+4)+3)
      GOTO 10216
10217 CALL PRINT(FD,AAACJ0)
      RETURN
      END
      SUBROUTINE PRINU0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER AAACK0(2)
      INTEGER AAACL0(7)
      INTEGER AAACM0(3)
      DATA AAACK0/173,0/
      DATA AAACL0/170,163,172,172,173,248,0/
      DATA AAACM0/170,238,0/
      CALL PRINT(FD,AAACK0)
      I=3+1
      GOTO 10221
10219 I=I+22
10221 IF((I.GT.RD(2)))GOTO 10220
        CALL PRINT(FD,AAACL0,RD(I+4)+3)
      GOTO 10219
10220 CALL PRINT(FD,AAACM0)
      RETURN
      END
      SUBROUTINE PRINW0(RD,FD,BUF)
      INTEGER RD(884)
      INTEGER FD
      INTEGER BUF(500)
      INTEGER I
      INTEGER AAACN0(2)
      INTEGER AAACO0
      INTEGER AAACP0(7)
      INTEGER AAACQ0(7)
      INTEGER AAACR0(9)
      INTEGER AAACS0(3)
      DATA AAACN0/252,0/
      DATA AAACP0/160,170,163,236,160,252,0/
      DATA AAACQ0/160,170,163,228,160,252,0/
      DATA AAACR0/160,170,163,172,163,243,160,252,0/
      DATA AAACS0/170,238,0/
      CALL PRINT(FD,AAACN0)
      I=3+1
      GOTO 10224
10222 I=I+22
10224 IF((I.GT.RD(2)))GOTO 10223
        AAACO0=RD(I)
        GOTO 10225
10226     CALL PRINT(FD,AAACP0,RD(I+4),BUF(RD(I+2)))
        GOTO 10227
10228     CALL PRINT(FD,AAACQ0,RD(I+4),BUF(RD(I+2)))
        GOTO 10227
10229     CALL PRINT(FD,AAACR0,RD(I+4),RD(I+1),BUF(RD(I+2)))
        GOTO 10227
10225   GOTO(10226,10228,10229),AAACO0
10227 GOTO 10222
10223 CALL PRINT(FD,AAACS0)
      RETURN
      END
      INTEGER FUNCTION GETROW(RD,FD,BUF)
      INTEGER RD(884)
      INTEGER FD
      INTEGER BUF(500),I
      INTEGER READF
      I=READF(BUF,RD(3),FD)
      GETROW=I
      RETURN
      END
      SUBROUTINE PUTROW(RD,FD,BUF)
      INTEGER RD(884)
      INTEGER FD
      INTEGER BUF(500)
      INTEGER ISATTY
      IF((ISATTY(FD).NE.1))GOTO 10230
        CALL PRINW0(RD,FD,BUF)
        GOTO 10231
10230   CALL WRITEF(BUF,RD(3),FD)
10231 RETURN
      END
      SUBROUTINE GETDA0(RD,I,BUF,DEST)
      INTEGER RD(884)
      INTEGER I,BUF(1),DEST(102)
      INTEGER J,K
      INTEGER AAACT0
      AAACT0=RD(I)
      GOTO 10232
10233   J=RD(I+2)
        DEST(1)=BUF(J)
        DEST(2)=BUF(J+1)
      GOTO 10234
10235   J=RD(I+2)
        DEST(1)=BUF(J)
        DEST(2)=BUF(J+1)
        DEST(3)=BUF(J+2)
        DEST(4)=BUF(J+3)
      GOTO 10234
10236   J=RD(I+3)
        K=RD(I+1)
        GOTO 10239
10237   J=J-(1)
        K=K-(1)
10239   IF((K.LE.0))GOTO 10238
        IF((BUF(J).NE.160))GOTO 10238
        GOTO 10237
10238   DEST(K+1)=0
        GOTO 10242
10240   J=J-(1)
        K=K-(1)
10242   IF((K.LE.0))GOTO 10241
          DEST(K)=BUF(J)
        GOTO 10240
10241 GOTO 10234
10232 GOTO(10233,10235,10236),AAACT0
10234 RETURN
      END
      SUBROUTINE PUTDA0(RD,I,BUF,SRC)
      INTEGER RD(884)
      INTEGER I,BUF(1),SRC(102)
      INTEGER J,K
      INTEGER AAACU0
      AAACU0=RD(I)
      GOTO 10243
10244   J=RD(I+2)
        BUF(J)=SRC(1)
        BUF(J+1)=SRC(2)
      GOTO 10245
10246   J=RD(I+2)
        BUF(J)=SRC(1)
        BUF(J+1)=SRC(2)
        BUF(J+2)=SRC(3)
        BUF(J+3)=SRC(4)
      GOTO 10245
10247   J=RD(I+2)
        K=1
        GOTO 10250
10248   J=J+(1)
        K=K+(1)
10250   IF((SRC(K).EQ.0))GOTO 10249
        IF((K.GT.RD(I+1)))GOTO 10249
          BUF(J)=SRC(K)
        GOTO 10248
10249   GOTO 10253
10251   K=K+(1)
        J=J+(1)
10253   IF((K.GT.RD(I+1)))GOTO 10252
          BUF(J)=160
        GOTO 10251
10252 GOTO 10245
10243 GOTO(10244,10246,10247),AAACU0
10245 RETURN
      END
      INTEGER FUNCTION COMPE0(RD,ROW1,ROW2)
      INTEGER RD(884)
      INTEGER ROW1(500),ROW2(500)
      INTEGER BUF1(500),BUF2(500)
      INTEGER R,I
      INTEGER COMPA0
      I=3+1
      GOTO 10256
10254 I=I+22
10256 IF((I.GT.RD(2)))GOTO 10255
        CALL GETDA0(RD,I,ROW1,BUF1)
        CALL GETDA0(RD,I,ROW2,BUF2)
        R=COMPA0(RD(I),BUF1,BUF2)
        IF((R.EQ.2))GOTO 10257
          COMPE0=R
          RETURN
10257 GOTO 10254
10255 COMPE0=2
      RETURN
      END
C ---- Long Name Map ----
C Rpn                            rpnaa0
C comparefield                   compa0
C printheader                    print0
C comparerow                     compe0
C Ap                             apaaa0
C Rd                             rdaaa0
C Pos2                           pos2a0
C Cbuflen                        cbufl0
C evalrel                        evalr0
C printtrailer                   prinu0
C getqualfield                   getqu0
C Rpnlen                         rpnle0
C compareinteger                 compb0
C comparestring                  compd0
C putdata                        putda0
C Arg                            argaa0
C findfield                      findf0
C findqualfield                  findq0
C Symtype                        symty0
C Symtext                        symte0
C convert                        conve0
C printrd                        prinv0
C printrow                       prinw0
C primary                        prima0
C comparereal                    compc0
C Errlab                         errla0
C getdata                        getda0
C Cbuf                           cbufa0
C addfieldtord                   addfi0
