# inner.s
inner.join_function (A,B,AKEY=1,BKEY=1)
{
# A,B are input matrices
# AKEY, BKEY are the positions of the key column in A and B
# result is a matrix
# g (matrix) = records present in both a and b
acols_dim(A)[2]
bcols_dim(B)[2]
alocinb_match(A[,AKEY],B[,BKEY])
blocina_match(B[,BKEY],A[,AKEY])
g1_sort( unique( c(A[blocina],B[alocinb]) ) )
g1_g1[ g1!=""]
glocina_match(g1,A[,AKEY])
glocinb_match(g1,B[,BKEY])
grows_length(g1)
gcols_acols+bcols-1
g_matrix(NA,grows,gcols)
g[,1]_g1
glast_1
gnext_glast+1
glast_gnext+acols-2
g[,gnext:glast]_A[glocina,-AKEY]
gnext_glast+1
glast_gnext+acols-2
g[,gnext:glast]_B[glocinb,-BKEY]
g
}

