You can also keep your original syntax simpler by just
putting SET EQNULL ON before your checks. That way
nulls will not match, so you can just check where one
variable <> other variable.
> I thought I would share with you a method I found for comparing
> field differences.
>
> Problem: decide if I need to insert a record into a previous
> address history file via action in a stored procedure. I was
> working an this complex IF statement to determine it the SYS_NEW
> record was different that SYS_OLD record. Say for a field such
> as HMainAddressLn. If you have SELECT HMainAddressLn INTO
> NHMainAddressLn INDICATOR NIvMainAddress FROM ... WHERE CURRENT
> OF SYS_NEW; SELECT HMainAddressLn INTO PHMainAddressLn INDICATOR
> PIvMainAddress FROM ... WHERE CURRENT OF SYS_OLD. I was writing
> the following:
> IF ((NHMainAddressLn <>.PHMainAddressLn) OR +
> (NHMainAddressLn IS NOT NULL AND PHMainAddressLn IS NULL) OR +
> (NHMainAddressLn IS NULL AND PHMainAddressLn IS NOT NULL)) OR +
> ... SAME TEST REPEATED FOR ADDITIONAL FIELDS ... THEN
> SET VAR VFieldsAreDif = 'YES'
> ENDIF
>