Your "devicenum=0" is in fact a wildcard, meaning: pair to any device of the correct type and transmission mode that's near.
ANT devices are supposed to have "nearly unique" device nums. Well, as the number space is very limited, they aren't really unique, but there's a fair chance that no double device nums are close to each other.
So display devices usually force a pairing procedure like:
1. tell the user "bring exactly one sensor close to me and ensure that it's switched on"
2. try to connect using the 0 wildcard
3. if a sensor is found, take it's device number from the responses and
4. save that for further connects - that now use this non-zero number instead of the wildcard
All this should however be explained in the basic ANT documents.
Cheers,
OMB