INTEGER RD1(884),RD2(884) INTEGER I,J,LASTI,COPYIT,S,SAMER0 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(-12) 10010 IF((GETROW(RD1,-10,ROW1).EQ.-1))GOTO 10011 COPYIT=1 CALL SEEKF(M,-12) 10012 IF(((GETROW(RD2,-12,ROW2).EQ.-1).OR.(COPYIT.NE.1)))GOTO 10013 SAMER0=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 SAMER0=0 10017 GOTO 10014 10015 IF((SAMER0.NE.1))GOTO 10018 COPYIT=0 10018 GOTO 10012 10013 IF((COPYIT.NE.1))GOTO 10019 CALL PUTROW(RD1,-11,ROW1) 10019 GOTO 10010 10011 IF((ISATTY(-11).NE.1))GOTO 10020 CALL PRINU0(RD1,-11) 10020 CALL SWT END INTEGER FUNCTION LOADRD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY,READF IF((ISATTY(FD).NE.1))GOTO 10021 CALL REMARK('Sorry, a relation can''t be read from the terminal. *') LOADRD=-3 RETURN 10021 IF((READF(RD(1),1,FD).NE.-1))GOTO 10022 LOADRD=-3 RETURN 10022 IF((READF(RD(2),RD(1)-1,FD).NE.-1))GOTO 10023 CALL REMARK('relation is corrupted!!.') LOADRD=-3 RETURN 10023 LOADRD=-2 RETURN END SUBROUTINE SAVERD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY IF((ISATTY(FD).NE.1))GOTO 10024 CALL PRINV0(RD,FD) GOTO 10025 10024 CALL WRITEF(RD,RD(1),FD) 10025 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 10028 10026 I=I+22 10028 IF((I.GT.RD(2)))GOTO 10027 AAAAD0=RD(I) GOTO 10029 10030 CALL CTOC(AAAAE0,TYPE,102) GOTO 10031 10032 CALL CTOC(AAAAF0,TYPE,102) GOTO 10031 10033 CALL CTOC(AAAAG0,TYPE,102) GOTO 10031 10029 GOTO(10030,10032,10033),AAAAD0 10031 CALL PRINT(FD,AAAAH0,TYPE,RD(I+1),RD(I+5)) GOTO 10026 10027 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 10034 ADDFI0=0 RETURN 10034 RD(I)=TYPE RD(I+4)=LENGTH(NAME) AAAAJ0=TYPE GOTO 10035 10036 RD(I+1)=2 RD(I+4)=MAX0(RD(I+4),10) GOTO 10037 10038 RD(I+1)=4 RD(I+4)=MAX0(RD(I+4),15) GOTO 10037 10039 RD(I+1)=LEN RD(I+4)=MAX0(RD(I+4),LEN) GOTO 10037 10035 GOTO(10036,10038,10039),AAAAJ0 CALL ERROR('in add_field_to_rd: bogus type passed.') 10037 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 10040 ADDFI0=0 RETURN 10040 ADDFI0=I RETURN END INTEGER FUNCTION FINDF0(RD,NAME) INTEGER RD(884) INTEGER NAME(1) INTEGER I INTEGER EQUAL I=3+1 GOTO 10043 10041 I=I+22 10043 IF((I.GT.RD(2)))GOTO 10042 IF((EQUAL(RD(I+5),NAME).NE.1))GOTO 10044 FINDF0=I RETURN 10044 GOTO 10041 10042 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 10045 10046 R=COMPB0(BUF1,BUF2) GOTO 10047 10048 R=COMPC0(BUF1,BUF2) GOTO 10047 10049 R=COMPD0(BUF1,BUF2) GOTO 10047 10045 GOTO(10046,10048,10049),AAAAK0 CALL PRINT(-15,AAAAL0,TYPE) R=2 10047 COMPA0=R RETURN END INTEGER FUNCTION COMPB0(I1,I2) INTEGER * 4 I1,I2 IF((I1.GE.I2))GOTO 10050 COMPB0=1 RETURN 10050 IF((I1.LE.I2))GOTO 10051 COMPB0=3 RETURN 10051 COMPB0=2 RETURN END INTEGER FUNCTION COMPC0(D1,D2) REAL * 8 D1,D2 IF((D1.GE.D2))GOTO 10052 COMPC0=1 RETURN 10052 IF((D1.LE.D2))GOTO 10053 COMPC0=3 RETURN 10053 COMPC0=2 RETURN END INTEGER FUNCTION COMPD0(S1,S2) INTEGER S1(1),S2(1) INTEGER I I=1 GOTO 10056 10054 I=I+(1) 10056 IF((S1(I).NE.S2(I)))GOTO 10055 IF((S1(I).EQ.0))GOTO 10055 GOTO 10054 10055 IF((S1(I).NE.S2(I)))GOTO 10057 COMPD0=2 RETURN 10057 IF((S1(I).EQ.0))GOTO 10059 IF((S1(I).LT.S2(I)))GOTO 10059 GOTO 10058 10059 COMPD0=1 RETURN 10058 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 10062 10060 I=I+22 10062 IF((I.GT.RD(2)))GOTO 10061 CALL PRINT(FD,AAAAN0,RD(I+4)+3) GOTO 10060 10061 CALL PRINT(FD,AAAAO0) CALL PRINT(FD,AAAAP0) I=3+1 GOTO 10065 10063 I=I+22 10065 IF((I.GT.RD(2)))GOTO 10064 CALL PRINT(FD,AAAAQ0,RD(I+4),RD(I+5)) GOTO 10063 10064 CALL PRINT(FD,AAAAR0) CALL PRINT(FD,AAAAS0) I=3+1 GOTO 10068 10066 I=I+22 10068 IF((I.GT.RD(2)))GOTO 10067 CALL PRINT(FD,AAAAT0,RD(I+4)+3) GOTO 10066 10067 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 10071 10069 I=I+22 10071 IF((I.GT.RD(2)))GOTO 10070 CALL PRINT(FD,AAAAW0,RD(I+4)+3) GOTO 10069 10070 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 10074 10072 I=I+22 10074 IF((I.GT.RD(2)))GOTO 10073 AAAAZ0=RD(I) GOTO 10075 10076 CALL PRINT(FD,AAABA0,RD(I+4),BUF(RD(I+2))) GOTO 10077 10078 CALL PRINT(FD,AAABB0,RD(I+4),BUF(RD(I+2))) GOTO 10077 10079 CALL PRINT(FD,AAABC0,RD(I+4),RD(I+1),BUF(RD(I+2))) GOTO 10077 10075 GOTO(10076,10078,10079),AAAAZ0 10077 GOTO 10072 10073 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 10080 CALL PRINW0(RD,FD,BUF) GOTO 10081 10080 CALL WRITEF(BUF,RD(3),FD) 10081 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 10082 10083 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) GOTO 10084 10085 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) DEST(3)=BUF(J+2) DEST(4)=BUF(J+3) GOTO 10084 10086 J=RD(I+3) K=RD(I+1) GOTO 10089 10087 J=J-(1) K=K-(1) 10089 IF((K.LE.0))GOTO 10088 IF((BUF(J).NE.160))GOTO 10088 GOTO 10087 10088 DEST(K+1)=0 GOTO 10092 10090 J=J-(1) K=K-(1) 10092 IF((K.LE.0))GOTO 10091 DEST(K)=BUF(J) GOTO 10090 10091 GOTO 10084 10082 GOTO(10083,10085,10086),AAABE0 10084 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 10093 10094 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) GOTO 10095 10096 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) BUF(J+2)=SRC(3) BUF(J+3)=SRC(4) GOTO 10095 10097 J=RD(I+2) K=1 GOTO 10100 10098 J=J+(1) K=K+(1) 10100 IF((SRC(K).EQ.0))GOTO 10099 IF((K.GT.RD(I+1)))GOTO 10099 BUF(J)=SRC(K) GOTO 10098 10099 GOTO 10103 10101 K=K+(1) J=J+(1) 10103 IF((K.GT.RD(I+1)))GOTO 10102 BUF(J)=160 GOTO 10101 10102 GOTO 10095 10093 GOTO(10094,10096,10097),AAABF0 10095 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 10106 10104 I=I+22 10106 IF((I.GT.RD(2)))GOTO 10105 CALL GETDA0(RD,I,ROW1,BUF1) CALL GETDA0(RD,I,ROW2,BUF2) R=COMPA0(RD(I),BUF1,BUF2) IF((R.EQ.2))GOTO 10107 COMPE0=R RETURN 10107 GOTO 10104 10105 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 samerow samer0 C printrd prinv0 C printrow prinw0 C comparereal compc0 C getdata getda0 C addfieldtord addfi0