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