At least on unreal ircd, "/helpop join" replies:
Syntax: JOIN <chan>,<chan2>,<chan3> <key1>,<key2>,<key3>
So the problem seems to be that you try to use a syntax
JOIN <chan1> <key1>,<chan2>
or
JOIN <chan1>,<chan2> <key1> (mean: you provide the key for chan2, but the ircd thinks you are sending the key for chan1)
You could solve this problem by loopig the parts of the $readini return.
alias autojoin {
var %chanstring = $readini(system\aj\autojoin.ini,$network,channel), %nr = 1
while ($gettok(%chanstring,%nr,44)) {
join $ifmatch
inc %nr
}
}