I am surprised that "IF dict IS NULL" compiles. I would expect similar to "IF arr IS NULL" which generate a -4340 error, and that the correct test would be "IF dict.getLength() = 0" just like dynamic array case "IF arr.getlength() = 0".
On the subject of DICTIONARY it would be nice to have the option to sort them into key order...
Just sort the keys array.
LET keys = dict.getkeys()
CALL keys.sort(NULL, FALSE)