The @IPAddress macro brings back blank spaces in place of zeros. Try this:

Code:
If TRIM(SUBSTR(@IPADDRESS0, 1, 3)) + "." + TRIM(SUBSTR(@IPADDRESS0, 5, 3))  + "." + TRIM(SUBSTR(@IPADDRESS0, 9, 3)) = "172.16.2"
? "Matched"
Else
? "Not Matched"
Endif