      INTEGER RD(884)
      INTEGER I
      INTEGER LOADRD
      INTEGER ROW(500)
      INTEGER GETROW
      INTEGER TYPE(102)
      INTEGER A$BUF(200)
      INTEGER PARSCL
      INTEGER AAAAA0(4)
      INTEGER AAAAB0(29)
      INTEGER AAAAC0
      INTEGER AAAAD0(8)
      INTEGER AAAAE0(5)
      INTEGER AAAAF0(7)
      INTEGER AAAAG0(24)
      INTEGER AAAAH0(18)
      INTEGER AAAAI0(18)
      INTEGER AAAAJ0(12)
      INTEGER AAAAK0(18)
      INTEGER AAAAL0(11)
      INTEGER AAAAM0(12)
      INTEGER AAAAN0
      INTEGER AAAAO0(8)
      INTEGER AAAAP0(5)
      INTEGER AAAAQ0(7)
      INTEGER AAAAR0(24)
      DATA AAAAA0/244,236,238,0/
      DATA AAAAB0/213,243,225,231,229,186,160,160,242,228,225,244,244,16
     *0,168,173,244,160,252,160,173,236,160,252,160,173,238,169,0/
      DATA AAAAD0/233,238,244,229,231,229,242,0/
      DATA AAAAE0/242,229,225,236,0/
      DATA AAAAF0/243,244,242,233,238,231,0/
      DATA AAAAG0/160,160,170,183,243,160,160,160,170,181,233,160,160,16
     *0,160,170,177,182,243,160,160,170,238,0/
      DATA AAAAH0/160,160,170,183,243,160,160,160,160,170,177,182,243,16
     *0,160,170,238,0/
      DATA AAAAI0/160,160,170,183,243,160,160,160,170,181,233,160,160,16
     *0,160,170,238,0/
      DATA AAAAJ0/160,160,170,183,243,160,160,160,160,170,238,0/
      DATA AAAAK0/160,160,170,181,233,160,160,160,160,170,177,182,243,16
     *0,160,170,238,0/
      DATA AAAAL0/160,160,170,177,182,243,160,160,170,238,0/
      DATA AAAAM0/160,160,170,181,233,160,160,160,160,170,238,0/
      DATA AAAAO0/233,238,244,229,231,229,242,0/
      DATA AAAAP0/242,229,225,236,0/
      DATA AAAAQ0/243,244,242,233,238,231,0/
      DATA AAAAR0/160,160,170,183,243,160,160,160,170,181,233,160,160,16
     *0,160,170,177,182,243,160,160,170,238,0/
      IF((PARSCL(AAAAA0,A$BUF).NE.-3))GOTO 10000
        CALL ERROR(AAAAB0)
10000 IF((LOADRD(RD,-10).EQ.-2))GOTO 10001
        CALL ERROR('Can''t access input relation.')
10001 I=3+1
      GOTO 10004
10002 I=I+22
10004 IF((I.GT.RD(2)))GOTO 10003
        IF((A$BUF(244-225+1).EQ.0))GOTO 10005
          AAAAC0=RD(I)
          GOTO 10006
10007       CALL CTOC(AAAAD0,TYPE,102)
          GOTO 10008
10009       CALL CTOC(AAAAE0,TYPE,102)
          GOTO 10008
10010       CALL CTOC(AAAAF0,TYPE,102)
          GOTO 10008
10006     GOTO(10007,10009,10010),AAAAC0
10008     IF((A$BUF(238-225+1).EQ.0))GOTO 10011
            IF((A$BUF(236-225+1).EQ.0))GOTO 10012
              CALL PRINT(-11,AAAAG0,TYPE,RD(I+1),RD(I+5))
              GOTO 10013
10012         IF((A$BUF(236-225+1).NE.0))GOTO 10014
                CALL PRINT(-11,AAAAH0,TYPE,RD(I+5))
10014       CONTINUE
10013       GOTO 10015
10011       IF((A$BUF(238-225+1).NE.0))GOTO 10016
              IF((A$BUF(236-225+1).EQ.0))GOTO 10017
                CALL PRINT(-11,AAAAI0,TYPE,RD(I+1))
                GOTO 10018
10017           IF((A$BUF(236-225+1).NE.0))GOTO 10019
                  CALL PRINT(-11,AAAAJ0,TYPE)
10019         CONTINUE
10018       CONTINUE
10016     CONTINUE
10015     GOTO 10020
10005     IF((A$BUF(244-225+1).NE.0))GOTO 10021
            IF((A$BUF(238-225+1).EQ.0))GOTO 10022
              IF((A$BUF(236-225+1).EQ.0))GOTO 10023
                CALL PRINT(-11,AAAAK0,RD(I+1),RD(I+5))
                GOTO 10024
10023           IF((A$BUF(236-225+1).NE.0))GOTO 10025
                  CALL PRINT(-11,AAAAL0,RD(I+5))
10025         CONTINUE
10024         GOTO 10026
10022         IF((A$BUF(238-225+1).NE.0))GOTO 10027
                IF((A$BUF(236-225+1).EQ.0))GOTO 10028
                  CALL PRINT(-11,AAAAM0,RD(I+1))
                  GOTO 10029
10028             IF((A$BUF(236-225+1).NE.0))GOTO 10030
                    AAAAN0=RD(I)
                    GOTO 10031
10032                 CALL CTOC(AAAAO0,TYPE,102)
                    GOTO 10033
10034                 CALL CTOC(AAAAP0,TYPE,102)
                    GOTO 10033
10035                 CALL CTOC(AAAAQ0,TYPE,102)
                    GOTO 10033
10031               GOTO(10032,10034,10035),AAAAN0
10033               CALL PRINT(-11,AAAAR0,TYPE,RD(I+1),RD(I+5))
10030           CONTINUE
10029         CONTINUE
10027       CONTINUE
10026     CONTINUE
10021   CONTINUE
10020 GOTO 10002
10003 CALL SWT
      END
      INTEGER FUNCTION LOADRD(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER ISATTY,READF
      IF((ISATTY(FD).NE.1))GOTO 10036
        CALL REMARK('Sorry, a relation can''t be read from the terminal.
     *')
        LOADRD=-3
        RETURN
10036 IF((READF(RD(1),1,FD).NE.-1))GOTO 10037
        LOADRD=-3
        RETURN
10037 IF((READF(RD(2),RD(1)-1,FD).NE.-1))GOTO 10038
        CALL REMARK('relation is corrupted!!.')
        LOADRD=-3
        RETURN
10038 LOADRD=-2
      RETURN
      END
      SUBROUTINE SAVERD(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER ISATTY
      IF((ISATTY(FD).NE.1))GOTO 10039
        CALL PRINT0(RD,FD)
        GOTO 10040
10039   CALL WRITEF(RD,RD(1),FD)
10040 RETURN
      END
      SUBROUTINE PRINT0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER TYPE(102)
      INTEGER AAAAS0(10)
      INTEGER AAAAT0(33)
      INTEGER AAAAU0(10)
      INTEGER AAAAV0
      INTEGER AAAAW0(8)
      INTEGER AAAAX0(5)
      INTEGER AAAAY0(7)
      INTEGER AAAAZ0(24)
      INTEGER AAABA0(10)
      DATA AAAAS0/170,179,185,172,172,173,248,170,238,0/
      DATA AAAAT0/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 AAAAU0/170,179,185,172,172,173,248,170,238,0/
      DATA AAAAW0/233,238,244,229,231,229,242,0/
      DATA AAAAX0/242,229,225,236,0/
      DATA AAAAY0/243,244,242,233,238,231,0/
      DATA AAAAZ0/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 AAABA0/170,179,185,172,172,173,248,170,238,0/
      CALL PRINT(FD,AAAAS0)
      CALL PRINT(FD,AAAAT0)
      CALL PRINT(FD,AAAAU0)
      I=3+1
      GOTO 10043
10041 I=I+22
10043 IF((I.GT.RD(2)))GOTO 10042
        AAAAV0=RD(I)
        GOTO 10044
10045     CALL CTOC(AAAAW0,TYPE,102)
        GOTO 10046
10047     CALL CTOC(AAAAX0,TYPE,102)
        GOTO 10046
10048     CALL CTOC(AAAAY0,TYPE,102)
        GOTO 10046
10044   GOTO(10045,10047,10048),AAAAV0
10046   CALL PRINT(FD,AAAAZ0,TYPE,RD(I+1),RD(I+5))
      GOTO 10041
10042 CALL PRINT(FD,AAABA0)
      RETURN
      END
      INTEGER FUNCTION ADDFI0(RD,TYPE,LEN,NAME)
      INTEGER RD(884)
      INTEGER TYPE,LEN
      INTEGER NAME(1)
      INTEGER I
      INTEGER AAABB0
      I=RD(2)+22
      IF((I+22-1.LE.884))GOTO 10049
        ADDFI0=0
        RETURN
10049 RD(I)=TYPE
      RD(I+4)=LENGTH(NAME)
      AAABB0=TYPE
      GOTO 10050
10051   RD(I+1)=2
        RD(I+4)=MAX0(RD(I+4),10)
      GOTO 10052
10053   RD(I+1)=4
        RD(I+4)=MAX0(RD(I+4),15)
      GOTO 10052
10054   RD(I+1)=LEN
        RD(I+4)=MAX0(RD(I+4),LEN)
      GOTO 10052
10050 GOTO(10051,10053,10054),AAABB0
        CALL ERROR('in add_field_to_rd: bogus type passed.')
10052 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 10055
        ADDFI0=0
        RETURN
10055 ADDFI0=I
      RETURN
      END
      INTEGER FUNCTION FINDF0(RD,NAME)
      INTEGER RD(884)
      INTEGER NAME(1)
      INTEGER I
      INTEGER EQUAL
      I=3+1
      GOTO 10058
10056 I=I+22
10058 IF((I.GT.RD(2)))GOTO 10057
        IF((EQUAL(RD(I+5),NAME).NE.1))GOTO 10059
          FINDF0=I
          RETURN
10059 GOTO 10056
10057 FINDF0=0
      RETURN
      END
      INTEGER FUNCTION COMPA0(TYPE,BUF1,BUF2)
      INTEGER TYPE
      INTEGER BUF1(500),BUF2(500)
      INTEGER R
      INTEGER COMPB0,COMPC0,COMPD0
      INTEGER AAABC0
      INTEGER AAABD0(34)
      DATA AAABD0/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/
      AAABC0=TYPE
      GOTO 10060
10061   R=COMPB0(BUF1,BUF2)
      GOTO 10062
10063   R=COMPC0(BUF1,BUF2)
      GOTO 10062
10064   R=COMPD0(BUF1,BUF2)
      GOTO 10062
10060 GOTO(10061,10063,10064),AAABC0
        CALL PRINT(-15,AAABD0,TYPE)
        R=2
10062 COMPA0=R
      RETURN
      END
      INTEGER FUNCTION COMPB0(I1,I2)
      INTEGER * 4 I1,I2
      IF((I1.GE.I2))GOTO 10065
        COMPB0=1
        RETURN
10065 IF((I1.LE.I2))GOTO 10066
        COMPB0=3
        RETURN
10066 COMPB0=2
      RETURN
      END
      INTEGER FUNCTION COMPC0(D1,D2)
      REAL * 8 D1,D2
      IF((D1.GE.D2))GOTO 10067
        COMPC0=1
        RETURN
10067 IF((D1.LE.D2))GOTO 10068
        COMPC0=3
        RETURN
10068 COMPC0=2
      RETURN
      END
      INTEGER FUNCTION COMPD0(S1,S2)
      INTEGER S1(1),S2(1)
      INTEGER I
      I=1
      GOTO 10071
10069 I=I+(1)
10071 IF((S1(I).NE.S2(I)))GOTO 10070
      IF((S1(I).EQ.0))GOTO 10070
      GOTO 10069
10070 IF((S1(I).NE.S2(I)))GOTO 10072
        COMPD0=2
        RETURN
10072 IF((S1(I).EQ.0))GOTO 10074
      IF((S1(I).LT.S2(I)))GOTO 10074
      GOTO 10073
10074   COMPD0=1
        RETURN
10073 COMPD0=3
      RETURN
      END
      SUBROUTINE PRINU0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER AAABE0(2)
      INTEGER AAABF0(7)
      INTEGER AAABG0(3)
      INTEGER AAABH0(2)
      INTEGER AAABI0(7)
      INTEGER AAABJ0(3)
      INTEGER AAABK0(2)
      INTEGER AAABL0(7)
      INTEGER AAABM0(3)
      DATA AAABE0/173,0/
      DATA AAABF0/170,163,172,172,173,248,0/
      DATA AAABG0/170,238,0/
      DATA AAABH0/252,0/
      DATA AAABI0/160,170,163,243,160,252,0/
      DATA AAABJ0/170,238,0/
      DATA AAABK0/173,0/
      DATA AAABL0/170,163,172,172,173,248,0/
      DATA AAABM0/170,238,0/
      CALL PRINT(FD,AAABE0)
      I=3+1
      GOTO 10077
10075 I=I+22
10077 IF((I.GT.RD(2)))GOTO 10076
        CALL PRINT(FD,AAABF0,RD(I+4)+3)
      GOTO 10075
10076 CALL PRINT(FD,AAABG0)
      CALL PRINT(FD,AAABH0)
      I=3+1
      GOTO 10080
10078 I=I+22
10080 IF((I.GT.RD(2)))GOTO 10079
        CALL PRINT(FD,AAABI0,RD(I+4),RD(I+5))
      GOTO 10078
10079 CALL PRINT(FD,AAABJ0)
      CALL PRINT(FD,AAABK0)
      I=3+1
      GOTO 10083
10081 I=I+22
10083 IF((I.GT.RD(2)))GOTO 10082
        CALL PRINT(FD,AAABL0,RD(I+4)+3)
      GOTO 10081
10082 CALL PRINT(FD,AAABM0)
      RETURN
      END
      SUBROUTINE PRINV0(RD,FD)
      INTEGER RD(884)
      INTEGER FD
      INTEGER I
      INTEGER AAABN0(2)
      INTEGER AAABO0(7)
      INTEGER AAABP0(3)
      DATA AAABN0/173,0/
      DATA AAABO0/170,163,172,172,173,248,0/
      DATA AAABP0/170,238,0/
      CALL PRINT(FD,AAABN0)
      I=3+1
      GOTO 10086
10084 I=I+22
10086 IF((I.GT.RD(2)))GOTO 10085
        CALL PRINT(FD,AAABO0,RD(I+4)+3)
      GOTO 10084
10085 CALL PRINT(FD,AAABP0)
      RETURN
      END
      SUBROUTINE PRINW0(RD,FD,BUF)
      INTEGER RD(884)
      INTEGER FD
      INTEGER BUF(500)
      INTEGER I
      INTEGER AAABQ0(2)
      INTEGER AAABR0
      INTEGER AAABS0(7)
      INTEGER AAABT0(7)
      INTEGER AAABU0(9)
      INTEGER AAABV0(3)
      DATA AAABQ0/252,0/
      DATA AAABS0/160,170,163,236,160,252,0/
      DATA AAABT0/160,170,163,228,160,252,0/
      DATA AAABU0/160,170,163,172,163,243,160,252,0/
      DATA AAABV0/170,238,0/
      CALL PRINT(FD,AAABQ0)
      I=3+1
      GOTO 10089
10087 I=I+22
10089 IF((I.GT.RD(2)))GOTO 10088
        AAABR0=RD(I)
        GOTO 10090
10091     CALL PRINT(FD,AAABS0,RD(I+4),BUF(RD(I+2)))
        GOTO 10092
10093     CALL PRINT(FD,AAABT0,RD(I+4),BUF(RD(I+2)))
        GOTO 10092
10094     CALL PRINT(FD,AAABU0,RD(I+4),RD(I+1),BUF(RD(I+2)))
        GOTO 10092
10090   GOTO(10091,10093,10094),AAABR0
10092 GOTO 10087
10088 CALL PRINT(FD,AAABV0)
      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 10095
        CALL PRINW0(RD,FD,BUF)
        GOTO 10096
10095   CALL WRITEF(BUF,RD(3),FD)
10096 RETURN
      END
      SUBROUTINE GETDA0(RD,I,BUF,DEST)
      INTEGER RD(884)
      INTEGER I,BUF(1),DEST(102)
      INTEGER J,K
      INTEGER AAABW0
      AAABW0=RD(I)
      GOTO 10097
10098   J=RD(I+2)
        DEST(1)=BUF(J)
        DEST(2)=BUF(J+1)
      GOTO 10099
10100   J=RD(I+2)
        DEST(1)=BUF(J)
        DEST(2)=BUF(J+1)
        DEST(3)=BUF(J+2)
        DEST(4)=BUF(J+3)
      GOTO 10099
10101   J=RD(I+3)
        K=RD(I+1)
        GOTO 10104
10102   J=J-(1)
        K=K-(1)
10104   IF((K.LE.0))GOTO 10103
        IF((BUF(J).NE.160))GOTO 10103
        GOTO 10102
10103   DEST(K+1)=0
        GOTO 10107
10105   J=J-(1)
        K=K-(1)
10107   IF((K.LE.0))GOTO 10106
          DEST(K)=BUF(J)
        GOTO 10105
10106 GOTO 10099
10097 GOTO(10098,10100,10101),AAABW0
10099 RETURN
      END
      SUBROUTINE PUTDA0(RD,I,BUF,SRC)
      INTEGER RD(884)
      INTEGER I,BUF(1),SRC(102)
      INTEGER J,K
      INTEGER AAABX0
      AAABX0=RD(I)
      GOTO 10108
10109   J=RD(I+2)
        BUF(J)=SRC(1)
        BUF(J+1)=SRC(2)
      GOTO 10110
10111   J=RD(I+2)
        BUF(J)=SRC(1)
        BUF(J+1)=SRC(2)
        BUF(J+2)=SRC(3)
        BUF(J+3)=SRC(4)
      GOTO 10110
10112   J=RD(I+2)
        K=1
        GOTO 10115
10113   J=J+(1)
        K=K+(1)
10115   IF((SRC(K).EQ.0))GOTO 10114
        IF((K.GT.RD(I+1)))GOTO 10114
          BUF(J)=SRC(K)
        GOTO 10113
10114   GOTO 10118
10116   K=K+(1)
        J=J+(1)
10118   IF((K.GT.RD(I+1)))GOTO 10117
          BUF(J)=160
        GOTO 10116
10117 GOTO 10110
10108 GOTO(10109,10111,10112),AAABX0
10110 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 10121
10119 I=I+22
10121 IF((I.GT.RD(2)))GOTO 10120
        CALL GETDA0(RD,I,ROW1,BUF1)
        CALL GETDA0(RD,I,ROW2,BUF2)
        R=COMPA0(RD(I),BUF1,BUF2)
        IF((R.EQ.2))GOTO 10122
          COMPE0=R
          RETURN
10122 GOTO 10119
10120 COMPE0=2
      RETURN
      END
C ---- Long Name Map ----
C comparefield                   compa0
C printheader                    prinu0
C comparerow                     compe0
C printtrailer                   prinv0
C compareinteger                 compb0
C comparestring                  compd0
C putdata                        putda0
C findfield                      findf0
C printrd                        print0
C printrow                       prinw0
C comparereal                    compc0
C getdata                        getda0
C addfieldtord                   addfi0