INTEGER RRDAA0(884),SRDAA0(884),TRDAA0(884) INTEGER RFDAA0,SFDAA0,TFDAA0 INTEGER AP,I,J,POS2,BP,RSTAT,COMP INTEGER RKEYS0(41),SKEYS0(41) INTEGER RROWA0(500),SROWA0(500),TROWA0(500) INTEGER X(500),Y(500),Z(500) INTEGER DEST(102),GARBA0(102) INTEGER LOADRD,ISATTY,ADDFI0,CREATE INTEGER FINDF0,GETROW,COMPA0,REWIND INTEGER ORDERS(41) INTEGER AAAAA0(6) INTEGER AAAAB0(6) INTEGER AAAAC0(6) INTEGER AAAAD0(6) INTEGER AAAAE0(20) INTEGER AAAAF0(20) INTEGER AAAAG0(13) INTEGER AAAAH0(20) INTEGER AAAAI0(13) INTEGER AAAAJ0(20) INTEGER AAAAK0(16) DATA AAAAA0/244,229,237,240,177,0/ DATA AAAAB0/244,229,237,240,177,0/ DATA AAAAC0/244,229,237,240,178,0/ DATA AAAAD0/244,229,237,240,178,0/ DATA AAAAE0/195,239,245,236,228,238,167,244,160,242,229,247,233,23 *8,228,160,210,170,238,0/ DATA AAAAF0/195,239,245,236,228,238,167,244,160,242,229,247,233,23 *8,228,160,211,170,238,0/ DATA AAAAG0/197,242,242,239,242,160,239,238,160,211,170,238,0/ DATA AAAAH0/195,239,245,236,228,238,167,244,160,242,229,247,233,23 *8,228,160,211,170,238,0/ DATA AAAAI0/197,242,242,239,242,160,239,238,160,211,170,238,0/ DATA AAAAJ0/195,239,245,236,228,238,167,244,160,242,229,247,233,23 *8,228,160,211,170,238,0/ DATA AAAAK0/211,160,236,239,239,235,243,160,229,237,240,244,249,17 *0,238,0/ IF((LOADRD(RRDAA0,-10).EQ.-2))GOTO 10000 CALL ERROR('Cannot load input relation 1.') 10000 IF((LOADRD(SRDAA0,-12).EQ.-2))GOTO 10001 CALL ERROR('Cannot load input relation 2.') 10001 TRDAA0(1)=3 TRDAA0(2)=3-22+1 TRDAA0(3)=0 AP=0 I=3+1 GOTO 10004 10002 I=I+22 10004 IF((I.GT.RRDAA0(2)))GOTO 10003 J=FINDF0(SRDAA0,RRDAA0(I+5)) IF((J.NE.0))GOTO 10005 POS2=ADDFI0(TRDAA0,RRDAA0(I),RRDAA0(I+1),RRDAA0(I+5)) AP=AP+1 RKEYS0(AP)=I ORDERS(AP)=225 10005 GOTO 10002 10003 BP=0 I=3+1 GOTO 10008 10006 I=I+22 10008 IF((I.GT.SRDAA0(2)))GOTO 10007 J=FINDF0(RRDAA0,SRDAA0(I+5)) IF((J.NE.0))GOTO 10009 CALL ERROR('Relation 2 has domain not defined in relation 1.') GOTO 10010 10009 BP=BP+1 ORDERS(BP)=225 SKEYS0(BP)=I AP=AP+1 ORDERS(AP)=225 RKEYS0(AP)=J 10010 GOTO 10006 10007 BP=BP+1 SKEYS0(BP)=0 AP=AP+1 RKEYS0(AP)=0 RFDAA0=CREATE(AAAAA0,3) IF((RFDAA0.NE.-3))GOTO 10011 CALL CANT(AAAAB0) CALL SWT 10011 SFDAA0=CREATE(AAAAC0,3) IF((SFDAA0.NE.-3))GOTO 10012 CALL CANT(AAAAD0) CALL SWT 10012 CALL SORT(RRDAA0,RKEYS0,ORDERS,-10,RFDAA0) CALL SORT(SRDAA0,SKEYS0,ORDERS,-12,SFDAA0) CALL SAVERD(TRDAA0,-11) IF((ISATTY(-11).NE.1))GOTO 10013 CALL PRINT0(TRDAA0,-11) 10013 IF((REWIND(RFDAA0).EQ.-2))GOTO 10014 CALL PRINT(-11,AAAAE0) CALL SWT 10014 IF((REWIND(SFDAA0).EQ.-2))GOTO 10015 CALL PRINT(-11,AAAAF0) CALL SWT 10015 I=GETROW(SRDAA0,SFDAA0,SROWA0) IF((I.NE.-3))GOTO 10016 CALL PRINT(-11,AAAAG0) CALL SWT 10016 I=1 GOTO 10019 10017 I=I+(1) 10019 IF((I.GT.102))GOTO 10018 GARBA0(I)=0 GOTO 10017 10018 IF((I.NE.-1))GOTO 10020 10021 IF((GETROW(RRDAA0,RFDAA0,RROWA0).EQ.-1))GOTO 10022 I=3+1 GOTO 10025 10023 I=I+22 10025 IF((I.GT.RRDAA0(2)))GOTO 10024 J=FINDF0(TRDAA0,RRDAA0(I+5)) IF((J.EQ.0))GOTO 10026 CALL GETDA0(RRDAA0,I,RROWA0,DEST) CALL PUTDA0(TRDAA0,J,TROWA0,DEST) 10026 GOTO 10023 10024 CALL PUTROW(TRDAA0,-11,TROWA0) GOTO 10021 10022 GOTO 10027 10020 I=3+1 GOTO 10030 10028 I=I+22 10030 IF((I.GT.TRDAA0(2)))GOTO 10029 CALL PUTDA0(TRDAA0,I,X,GARBA0) GOTO 10028 10029 RSTAT=GETROW(RRDAA0,RFDAA0,RROWA0) 10031 IF((RSTAT.EQ.-1))GOTO 10032 I=3+1 GOTO 10035 10033 I=I+22 10035 IF((I.GT.RRDAA0(2)))GOTO 10034 J=FINDF0(TRDAA0,RRDAA0(I+5)) IF((J.EQ.0))GOTO 10036 CALL GETDA0(RRDAA0,I,RROWA0,DEST) CALL PUTDA0(TRDAA0,J,Y,DEST) 10036 GOTO 10033 10034 IF((COMPA0(TRDAA0,X,Y).EQ.2))GOTO 10037 I=3+1 GOTO 10040 10038 I=I+22 10040 IF((I.GT.TRDAA0(2)))GOTO 10039 CALL GETDA0(TRDAA0,I,Y,DEST) CALL PUTDA0(TRDAA0,I,X,DEST) GOTO 10038 10039 IF((REWIND(SFDAA0).EQ.-2))GOTO 10041 CALL PRINT(-11,AAAAH0) CALL SWT 10041 I=GETROW(SRDAA0,SFDAA0,SROWA0) IF((I.NE.-3))GOTO 10042 CALL PRINT(-11,AAAAI0) CALL SWT 10042 CONTINUE 10037 I=3+1 GOTO 10045 10043 I=I+22 10045 IF((I.GT.RRDAA0(2)))GOTO 10044 J=FINDF0(SRDAA0,RRDAA0(I+5)) IF((J.EQ.0))GOTO 10046 CALL GETDA0(RRDAA0,I,RROWA0,DEST) CALL PUTDA0(SRDAA0,J,Z,DEST) 10046 GOTO 10043 10044 COMP=COMPA0(SRDAA0,Z,SROWA0) GOTO 10047 10048 RSTAT=GETROW(RRDAA0,RFDAA0,RROWA0) GOTO 10049 10050 IF((GETROW(SRDAA0,SFDAA0,SROWA0).NE.-1))GOTO 10051 CALL PUTROW(TRDAA0,-11,X) IF((REWIND(SFDAA0).EQ.-2))GOTO 10052 CALL PRINT(-11,AAAAJ0) CALL SWT 10052 IF((GETROW(SRDAA0,SFDAA0,SROWA0).NE.-1))GOTO 10053 CALL PRINT(-11,AAAAK0) CALL SWT 10053 I=3+1 GOTO 10056 10054 I=I+22 10056 IF((I.GT.TRDAA0(2)))GOTO 10055 CALL GETDA0(TRDAA0,I,X,DEST) CALL PUTDA0(TRDAA0,I,Y,DEST) GOTO 10054 10055 CONTINUE 10057 IF((COMPA0(TRDAA0,X,Y).NE.2))GOTO 10058 RSTAT=GETROW(RRDAA0,RFDAA0,RROWA0) IF((RSTAT.EQ.-1))GOTO 10059 I=3+1 GOTO 10062 10060 I=I+22 10062 IF((I.GT.RRDAA0(2)))GOTO 10061 J=FINDF0(TRDAA0,RRDAA0(I+5)) IF((J.EQ.0))GOTO 10063 CALL GETDA0(RRDAA0,I,RROWA0,DEST) CALL PUTDA0(TRDAA0,J,Y,DEST) 10063 GOTO 10060 10061 GOTO 10064 10059 I=3+1 GOTO 10067 10065 I=I+22 10067 IF((I.GT.TRDAA0(2)))GOTO 10066 CALL PUTDA0(TRDAA0,I,Y,GARBA0) GOTO 10065 10066 CONTINUE 10064 GOTO 10057 10058 GOTO 10068 10051 RSTAT=GETROW(RRDAA0,RFDAA0,RROWA0) 10068 GOTO 10049 10069 I=3+1 GOTO 10072 10070 I=I+22 10072 IF((I.GT.TRDAA0(2)))GOTO 10071 CALL GETDA0(TRDAA0,I,X,DEST) CALL PUTDA0(TRDAA0,I,Y,DEST) GOTO 10070 10071 CONTINUE 10073 IF((COMPA0(TRDAA0,X,Y).NE.2))GOTO 10074 RSTAT=GETROW(RRDAA0,RFDAA0,RROWA0) IF((RSTAT.EQ.-1))GOTO 10075 I=3+1 GOTO 10078 10076 I=I+22 10078 IF((I.GT.RRDAA0(2)))GOTO 10077 J=FINDF0(TRDAA0,RRDAA0(I+5)) IF((J.EQ.0))GOTO 10079 CALL GETDA0(RRDAA0,I,RROWA0,DEST) CALL PUTDA0(TRDAA0,J,Y,DEST) 10079 GOTO 10076 10077 GOTO 10080 10075 I=3+1 GOTO 10083 10081 CONTINUE 2 I=I+22 10083 IF((I.GT.TRDAA0(2)))GOTO 10082 CALL PUTDA0(TRDAA0,I,Y,GARBA0) GOTO 10081 10082 CONTINUE 10080 GOTO 10073 10074 GOTO 10049 10049 GOTO 10084 10047 IF((COMP.EQ.1))GOTO 10048 IF((COMP.EQ.2))GOTO 10050 IF((COMP.EQ.3))GOTO 10069 10084 GOTO 10031 10032 CONTINUE 10027 IF((ISATTY(-11).NE.1))GOTO 10085 CALL PRINU0(TRDAA0,-11) 10085 CALL CLOSE(RFDAA0) CALL CLOSE(SFDAA0) CALL SWT END SUBROUTINE SORT(RD,KEYS,ORDERS,IFD,OFD) INTEGER RD(884) INTEGER KEYS(41),ORDERS(41) INTEGER IFD,OFD INTEGER ROWBUF(32768),NAME(30) INTEGER INFIL(7),ROWPTR(4096),NROWS,HIGH,LIM,LOW,T,I INTEGER GTEXT INTEGER OUTFD INTEGER MAKFIL,OPEN HIGH=0 10086 T=GTEXT(RD,ROWPTR,NROWS,ROWBUF,IFD) CALL QUICK(RD,KEYS,ORDERS,ROWPTR,NROWS,ROWBUF) IF((T.NE.-1))GOTO 10088 IF((HIGH.GT.0))GOTO 10088 GOTO 10087 10088 HIGH=HIGH+(1) OUTFD=MAKFIL(HIGH) CALL PTEXT(RD,ROWPTR,NROWS,ROWBUF,OUTFD) CALL CLOSE(OUTFD) 10087 CONTINUE IF((T.NE.-1))GOTO 10086 IF((HIGH.NE.0))GOTO 10089 CALL PTEXT(RD,ROWPTR,NROWS,ROWBUF,OFD) CALL REWIND(OFD) RETURN 10089 LOW=1 GOTO 10092 10090 LOW=LOW+(7) 10092 IF((LOW.GE.HIGH))GOTO 10091 LIM=MIN0(LOW+7-1,HIGH) CALL GOPEN(INFIL,LOW,LIM) IF((LIM.LT.HIGH))GOTO 10093 CALL MERGE(RD,KEYS,ORDERS,INFIL,LIM-LOW+1,OFD) GOTO 10094 10093 HIGH=HIGH+(1) OUTFD=MAKFIL(HIGH) CALL MERGE(RD,KEYS,ORDERS,INFIL,LIM-LOW+1,OUTFD) CALL CLOSE(OUTFD) 10094 CALL GREMOV(INFIL,LOW,LIM) GOTO 10090 10091 CALL REWIND(OFD) RETURN END SUBROUTINE GNAME(N,NAME) INTEGER N INTEGER NAME(30) INTEGER AAAAL0(17) DATA AAAAL0/189,244,229,237,240,189,175,242,243,189,240,233,228,18 *9,170,233,0/ CALL ENCODE(NAME,30,AAAAL0,N) RETURN END INTEGER FUNCTION MAKFIL(N) INTEGER N INTEGER NAME(30) INTEGER CREATE CALL GNAME(N,NAME) MAKFIL=CREATE(NAME,3) IF((MAKFIL.NE.-3))GOTO 10095 CALL CANT(NAME) 10095 RETURN END SUBROUTINE GOPEN(INFIL,LOW,LIM) INTEGER INFIL(7) INTEGER LOW,LIM INTEGER NAME(30) INTEGER I INTEGER OPEN I=1 GOTO 10098 10096 I=I+(1) 10098 IF((I.GT.LIM-LOW+1))GOTO 10097 CALL GNAME(LOW+I-1,NAME) INFIL(I)=OPEN(NAME,1) IF((INFIL(I).NE.-3))GOTO 10099 CALL CANT(NAME) 10099 GOTO 10096 10097 RETURN END SUBROUTINE GREMOV(INFIL,LOW,LIM) INTEGER INFIL(7) INTEGER LOW,LIM INTEGER NAME(30) INTEGER I I=1 GOTO 10102 10100 I=I+(1) 10102 IF((I.GT.LIM-LOW+1))GOTO 10101 CALL CLOSE(INFIL(I)) CALL GNAME(LOW+I-1,NAME) CALL REMOVE(NAME) GOTO 10100 10101 RETURN END SUBROUTINE MERGE(RD,KEYS,ORDERS,INFIL,NFILES,OUTFIL) INTEGER RD(884) INTEGER KEYS(41),ORDERS(41) INTEGER INFIL(7),OUTFIL INTEGER NFILES INTEGER ROWBUF(900) INTEGER GETROW INTEGER I,INF,RBP,RP1,NF,ROWPTR(7) RBP=1 NF=0 I=1 GOTO 10105 10103 I=I+(1) 10105 IF((I.GT.NFILES))GOTO 10104 IF((GETROW(RD,INFIL(I),ROWBUF(RBP)).EQ.-1))GOTO 10106 NF=NF+(1) ROWPTR(NF)=RBP RBP=RBP+(RD(3)) 10106 GOTO 10103 10104 CALL QUICK(RD,KEYS,ORDERS,ROWPTR,NF,ROWBUF) 10107 IF((NF.LE.0))GOTO 10108 RP1=ROWPTR(1) CALL PUTROW(RD,OUTFIL,ROWBUF(RP1)) INF=RP1/RD(3)+1 IF((GETROW(RD,INFIL(INF),ROWBUF(RP1)).NE.-1))GOTO 10109 ROWPTR(1)=ROWPTR(NF) NF=NF-(1) 10109 CALL REHEAP(RD,KEYS,ORDERS,ROWPTR,NF,ROWBUF) GOTO 10107 10108 RETURN END SUBROUTINE REHEAP(RD,KEYS,ORDERS,ROWPTR,NF,ROWBUF) INTEGER RD(884) INTEGER KEYS(41),ORDERS(41) INTEGER ROWPTR(1),NF INTEGER ROWBUF(32768) INTEGER I,J INTEGER COMPB0 I=1 GOTO 10112 10110 I=J 10112 IF((2*I.GT.NF))GOTO 10111 J=2*I IF((J.GE.NF))GOTO 10113 IF((COMPB0(RD,KEYS,ORDERS,ROWPTR(J),ROWPTR(J+1),ROWBUF).LE.0)) *GOTO 10114 J=J+(1) 10114 CONTINUE 10113 IF((COMPB0(RD,KEYS,ORDERS,ROWPTR(I),ROWPTR(J),ROWBUF).GT.0))GOTO * 10115 GOTO 10111 10115 CALL EXCHAN(ROWPTR(I),ROWPTR(J),ROWBUF) GOTO 10110 10111 RETURN END INTEGER FUNCTION GTEXT(RD,ROWPTR,NROWS,ROWBUF,INFILE) INTEGER RD(884) INTEGER ROWPTR(4096),NROWS,I INTEGER ROWBUF(32768) INTEGER INFILE,OUTFI0 INTEGER RBP,LEN INTEGER GETROW NROWS=0 RBP=1 10116 IF((GETROW(RD,INFILE,ROWBUF(RBP)).NE.-1))GOTO 10117 GTEXT=-1 RETURN 10117 NROWS=NROWS+(1) ROWPTR(NROWS)=RBP RBP=RBP+(RD(3)) IF((RBP.GE.32768-102))GOTO 10118 IF((NROWS.GE.4096))GOTO 10118 GOTO 10116 10118 CONTINUE GTEXT=-2 RETURN END SUBROUTINE PTEXT(RD,ROWPTR,NROWS,ROWBUF,OUTFIL) INTEGER RD(884) INTEGER ROWPTR(4096),NROWS INTEGER ROWBUF(32768) INTEGER OUTFIL INTEGER I,J I=1 GOTO 10121 10119 I=I+(1) 10121 IF((I.GT.NROWS))GOTO 10120 J=ROWPTR(I) CALL PUTROW(RD,OUTFIL,ROWBUF(J)) GOTO 10119 10120 RETURN END INTEGER FUNCTION COMPB0(RD,KEYS,ORDERS,RP1,RP2,ROWBUF) INTEGER RD(884) INTEGER KEYS(41),ORDERS(41) INTEGER RP1,RP2 INTEGER ROWBUF(1) INTEGER K,R,KP INTEGER BUF1(500),BUF2(500) INTEGER COMPC0 KP=1 GOTO 10124 10122 KP=KP+(1) 10124 IF((KEYS(KP).EQ.0))GOTO 10123 K=KEYS(KP) CALL GETDA0(RD,K,ROWBUF(RP1),BUF1) CALL GETDA0(RD,K,ROWBUF(RP2),BUF2) R=COMPC0(RD(K),BUF1,BUF2) IF((R.EQ.2))GOTO 10125 COMPB0=(R-2)*ORDERS(KP) RETURN 10125 GOTO 10122 10123 COMPB0=0 RETURN END SUBROUTINE EXCHAN(RP1,RP2,ROWBUF) INTEGER RP1,RP2 INTEGER ROWBUF(1) INTEGER K K=RP1 RP1=RP2 RP2=K RETURN END SUBROUTINE QUICK(RD,KEYS,ORDERS,ROWPTR,NROWS,ROWBUF) INTEGER RD(884) INTEGER KEYS(41),ORDERS(41) INTEGER ROWPTR(1),NROWS INTEGER ROWBUF(1) INTEGER I,J,LV(12),P,PIVROW,UV(12) INTEGER COMPB0 LV(1)=1 UV(1)=NROWS P=1 10126 IF((P.LE.0))GOTO 10127 IF((LV(P).LT.UV(P)))GOTO 10128 P=P-(1) GOTO 10129 10128 I=LV(P)-1 J=UV(P) PIVROW=ROWPTR(J) 10130 IF((I.GE.J))GOTO 10131 I=I+(1) GOTO 10134 10132 I=I+(1) 10134 IF((COMPB0(RD,KEYS,ORDERS,ROWPTR(I),PIVROW,ROWBUF).GE.0))GOT *O 10133 GOTO 10132 10133 J=J-(1) GOTO 10137 10135 J=J-(1) 10137 IF((J.LE.I))GOTO 10136 IF((COMPB0(RD,KEYS,ORDERS,ROWPTR(J),PIVROW,ROWBUF).GT.0))G *OTO 10138 GOTO 10136 10138 GOTO 10135 10136 IF((I.GE.J))GOTO 10139 CALL EXCHAN(ROWPTR(I),ROWPTR(J),ROWBUF) 10139 GOTO 10130 10131 J=UV(P) CALL EXCHAN(ROWPTR(I),ROWPTR(J),ROWBUF) IF((I-LV(P).GE.UV(P)-I))GOTO 10140 LV(P+1)=LV(P) UV(P+1)=I-1 LV(P)=I+1 GOTO 10141 10140 LV(P+1)=I+1 UV(P+1)=UV(P) UV(P)=I-1 10141 P=P+(1) 10129 GOTO 10126 10127 RETURN END INTEGER FUNCTION LOADRD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY,READF IF((ISATTY(FD).NE.1))GOTO 10142 CALL REMARK('Sorry, a relation can''t be read from the terminal. *') LOADRD=-3 RETURN 10142 IF((READF(RD(1),1,FD).NE.-1))GOTO 10143 LOADRD=-3 RETURN 10143 IF((READF(RD(2),RD(1)-1,FD).NE.-1))GOTO 10144 CALL REMARK('relation is corrupted!!.') LOADRD=-3 RETURN 10144 LOADRD=-2 RETURN END SUBROUTINE SAVERD(RD,FD) INTEGER RD(884) INTEGER FD INTEGER ISATTY IF((ISATTY(FD).NE.1))GOTO 10145 CALL PRINV0(RD,FD) GOTO 10146 10145 CALL WRITEF(RD,RD(1),FD) 10146 RETURN END SUBROUTINE PRINV0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER TYPE(102) INTEGER AAAAM0(10) INTEGER AAAAN0(33) INTEGER AAAAO0(10) INTEGER AAAAP0 INTEGER AAAAQ0(8) INTEGER AAAAR0(5) INTEGER AAAAS0(7) INTEGER AAAAT0(24) INTEGER AAAAU0(10) DATA AAAAM0/170,179,185,172,172,173,248,170,238,0/ DATA AAAAN0/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 AAAAO0/170,179,185,172,172,173,248,170,238,0/ DATA AAAAQ0/233,238,244,229,231,229,242,0/ DATA AAAAR0/242,229,225,236,0/ DATA AAAAS0/243,244,242,233,238,231,0/ DATA AAAAT0/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 AAAAU0/170,179,185,172,172,173,248,170,238,0/ CALL PRINT(FD,AAAAM0) CALL PRINT(FD,AAAAN0) CALL PRINT(FD,AAAAO0) I=3+1 GOTO 10149 10147 I=I+22 10149 IF((I.GT.RD(2)))GOTO 10148 AAAAP0=RD(I) GOTO 10150 10151 CALL CTOC(AAAAQ0,TYPE,102) GOTO 10152 10153 CALL CTOC(AAAAR0,TYPE,102) GOTO 10152 10154 CALL CTOC(AAAAS0,TYPE,102) GOTO 10152 10150 GOTO(10151,10153,10154),AAAAP0 10152 CALL PRINT(FD,AAAAT0,TYPE,RD(I+1),RD(I+5)) GOTO 10147 10148 CALL PRINT(FD,AAAAU0) RETURN END INTEGER FUNCTION ADDFI0(RD,TYPE,LEN,NAME) INTEGER RD(884) INTEGER TYPE,LEN INTEGER NAME(1) INTEGER I INTEGER AAAAV0 I=RD(2)+22 IF((I+22-1.LE.884))GOTO 10155 ADDFI0=0 RETURN 10155 RD(I)=TYPE RD(I+4)=LENGTH(NAME) AAAAV0=TYPE GOTO 10156 10157 RD(I+1)=2 RD(I+4)=MAX0(RD(I+4),10) GOTO 10158 10159 RD(I+1)=4 RD(I+4)=MAX0(RD(I+4),15) GOTO 10158 10160 RD(I+1)=LEN RD(I+4)=MAX0(RD(I+4),LEN) GOTO 10158 10156 GOTO(10157,10159,10160),AAAAV0 CALL ERROR('in add_field_to_rd: bogus type passed.') 10158 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 10161 ADDFI0=0 RETURN 10161 ADDFI0=I RETURN END INTEGER FUNCTION FINDF0(RD,NAME) INTEGER RD(884) INTEGER NAME(1) INTEGER I INTEGER EQUAL I=3+1 GOTO 10164 10162 I=I+22 10164 IF((I.GT.RD(2)))GOTO 10163 IF((EQUAL(RD(I+5),NAME).NE.1))GOTO 10165 FINDF0=I RETURN 10165 GOTO 10162 10163 FINDF0=0 RETURN END INTEGER FUNCTION COMPC0(TYPE,BUF1,BUF2) INTEGER TYPE INTEGER BUF1(500),BUF2(500) INTEGER R INTEGER COMPD0,COMPE0,COMPF0 INTEGER AAAAW0 INTEGER AAAAX0(34) DATA AAAAX0/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/ AAAAW0=TYPE GOTO 10166 10167 R=COMPD0(BUF1,BUF2) GOTO 10168 10169 R=COMPE0(BUF1,BUF2) GOTO 10168 10170 R=COMPF0(BUF1,BUF2) GOTO 10168 10166 GOTO(10167,10169,10170),AAAAW0 CALL PRINT(-15,AAAAX0,TYPE) R=2 10168 COMPC0=R RETURN END INTEGER FUNCTION COMPD0(I1,I2) INTEGER * 4 I1,I2 IF((I1.GE.I2))GOTO 10171 COMPD0=1 RETURN 10171 IF((I1.LE.I2))GOTO 10172 COMPD0=3 RETURN 10172 COMPD0=2 RETURN END INTEGER FUNCTION COMPE0(D1,D2) REAL * 8 D1,D2 IF((D1.GE.D2))GOTO 10173 COMPE0=1 RETURN 10173 IF((D1.LE.D2))GOTO 10174 COMPE0=3 RETURN 10174 COMPE0=2 RETURN END INTEGER FUNCTION COMPF0(S1,S2) INTEGER S1(1),S2(1) INTEGER I I=1 GOTO 10177 10175 I=I+(1) 10177 IF((S1(I).NE.S2(I)))GOTO 10176 IF((S1(I).EQ.0))GOTO 10176 GOTO 10175 10176 IF((S1(I).NE.S2(I)))GOTO 10178 COMPF0=2 RETURN 10178 IF((S1(I).EQ.0))GOTO 10180 IF((S1(I).LT.S2(I)))GOTO 10180 GOTO 10179 10180 COMPF0=1 RETURN 10179 COMPF0=3 RETURN END SUBROUTINE PRINT0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER AAAAY0(2) INTEGER AAAAZ0(7) INTEGER AAABA0(3) INTEGER AAABB0(2) INTEGER AAABC0(7) INTEGER AAABD0(3) INTEGER AAABE0(2) INTEGER AAABF0(7) INTEGER AAABG0(3) DATA AAAAY0/173,0/ DATA AAAAZ0/170,163,172,172,173,248,0/ DATA AAABA0/170,238,0/ DATA AAABB0/252,0/ DATA AAABC0/160,170,163,243,160,252,0/ DATA AAABD0/170,238,0/ DATA AAABE0/173,0/ DATA AAABF0/170,163,172,172,173,248,0/ DATA AAABG0/170,238,0/ CALL PRINT(FD,AAAAY0) I=3+1 GOTO 10183 10181 I=I+22 10183 IF((I.GT.RD(2)))GOTO 10182 CALL PRINT(FD,AAAAZ0,RD(I+4)+3) GOTO 10181 10182 CALL PRINT(FD,AAABA0) CALL PRINT(FD,AAABB0) I=3+1 GOTO 10186 10184 I=I+22 10186 IF((I.GT.RD(2)))GOTO 10185 CALL PRINT(FD,AAABC0,RD(I+4),RD(I+5)) GOTO 10184 10185 CALL PRINT(FD,AAABD0) CALL PRINT(FD,AAABE0) I=3+1 GOTO 10189 10187 I=I+22 10189 IF((I.GT.RD(2)))GOTO 10188 CALL PRINT(FD,AAABF0,RD(I+4)+3) GOTO 10187 10188 CALL PRINT(FD,AAABG0) RETURN END SUBROUTINE PRINU0(RD,FD) INTEGER RD(884) INTEGER FD INTEGER I INTEGER AAABH0(2) INTEGER AAABI0(7) INTEGER AAABJ0(3) DATA AAABH0/173,0/ DATA AAABI0/170,163,172,172,173,248,0/ DATA AAABJ0/170,238,0/ CALL PRINT(FD,AAABH0) I=3+1 GOTO 10192 10190 I=I+22 10192 IF((I.GT.RD(2)))GOTO 10191 CALL PRINT(FD,AAABI0,RD(I+4)+3) GOTO 10190 10191 CALL PRINT(FD,AAABJ0) RETURN END SUBROUTINE PRINW0(RD,FD,BUF) INTEGER RD(884) INTEGER FD INTEGER BUF(500) INTEGER I INTEGER AAABK0(2) INTEGER AAABL0 INTEGER AAABM0(7) INTEGER AAABN0(7) INTEGER AAABO0(9) INTEGER AAABP0(3) DATA AAABK0/252,0/ DATA AAABM0/160,170,163,236,160,252,0/ DATA AAABN0/160,170,163,228,160,252,0/ DATA AAABO0/160,170,163,172,163,243,160,252,0/ DATA AAABP0/170,238,0/ CALL PRINT(FD,AAABK0) I=3+1 GOTO 10195 10193 I=I+22 10195 IF((I.GT.RD(2)))GOTO 10194 AAABL0=RD(I) GOTO 10196 10197 CALL PRINT(FD,AAABM0,RD(I+4),BUF(RD(I+2))) GOTO 10198 10199 CALL PRINT(FD,AAABN0,RD(I+4),BUF(RD(I+2))) GOTO 10198 10200 CALL PRINT(FD,AAABO0,RD(I+4),RD(I+1),BUF(RD(I+2))) GOTO 10198 10196 GOTO(10197,10199,10200),AAABL0 10198 GOTO 10193 10194 CALL PRINT(FD,AAABP0) 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 10201 CALL PRINW0(RD,FD,BUF) GOTO 10202 10201 CALL WRITEF(BUF,RD(3),FD) 10202 RETURN END SUBROUTINE GETDA0(RD,I,BUF,DEST) INTEGER RD(884) INTEGER I,BUF(1),DEST(102) INTEGER J,K INTEGER AAABQ0 AAABQ0=RD(I) GOTO 10203 10204 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) GOTO 10205 10206 J=RD(I+2) DEST(1)=BUF(J) DEST(2)=BUF(J+1) DEST(3)=BUF(J+2) DEST(4)=BUF(J+3) GOTO 10205 10207 J=RD(I+3) K=RD(I+1) GOTO 10210 10208 J=J-(1) K=K-(1) 10210 IF((K.LE.0))GOTO 10209 IF((BUF(J).NE.160))GOTO 10209 GOTO 10208 10209 DEST(K+1)=0 GOTO 10213 10211 J=J-(1) K=K-(1) 10213 IF((K.LE.0))GOTO 10212 DEST(K)=BUF(J) GOTO 10211 10212 GOTO 10205 10203 GOTO(10204,10206,10207),AAABQ0 10205 RETURN END SUBROUTINE PUTDA0(RD,I,BUF,SRC) INTEGER RD(884) INTEGER I,BUF(1),SRC(102) INTEGER J,K INTEGER AAABR0 AAABR0=RD(I) GOTO 10214 10215 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) GOTO 10216 10217 J=RD(I+2) BUF(J)=SRC(1) BUF(J+1)=SRC(2) BUF(J+2)=SRC(3) BUF(J+3)=SRC(4) GOTO 10216 10218 J=RD(I+2) K=1 GOTO 10221 10219 J=J+(1) K=K+(1) 10221 IF((SRC(K).EQ.0))GOTO 10220 IF((K.GT.RD(I+1)))GOTO 10220 BUF(J)=SRC(K) GOTO 10219 10220 GOTO 10224 10222 K=K+(1) J=J+(1) 10224 IF((K.GT.RD(I+1)))GOTO 10223 BUF(J)=160 GOTO 10222 10223 GOTO 10216 10214 GOTO(10215,10217,10218),AAABR0 10216 RETURN END INTEGER FUNCTION COMPA0(RD,ROW1,ROW2) INTEGER RD(884) INTEGER ROW1(500),ROW2(500) INTEGER BUF1(500),BUF2(500) INTEGER R,I INTEGER COMPC0 I=3+1 GOTO 10227 10225 I=I+22 10227 IF((I.GT.RD(2)))GOTO 10226 CALL GETDA0(RD,I,ROW1,BUF1) CALL GETDA0(RD,I,ROW2,BUF2) R=COMPC0(RD(I),BUF1,BUF2) IF((R.EQ.2))GOTO 10228 COMPA0=R RETURN 10228 GOTO 10225 10226 COMPA0=2 RETURN END C ---- Long Name Map ---- C comparefield compc0 C comparerow compa0 C printheader print0 C Rkeys rkeys0 C compare compb0 C Skeys skeys0 C printtrailer prinu0 C putdata putda0 C compareinteger compd0 C comparestring compf0 C garbage garba0 C findfield findf0 C outfile outfi0 C Rfd rfdaa0 C Sfd sfdaa0 C Tfd tfdaa0 C printrd prinv0 C printrow prinw0 C comparereal compe0 C Rrd rrdaa0 C Rrow rrowa0 C getdata getda0 C Srd srdaa0 C Srow srowa0 C Trd trdaa0 C Trow trowa0 C addfieldtord addfi0