guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi SEKAR,
The EVALUATE command provides a shorthand notation for a series of nested IF statements.
Another example
Evaluate sqlcode
when +0
Continue
when +100
Display ' row not found'
When other
Raise an error
End-Evaluate.
In these code if sqlcode is eq to 0 it will execute next sentennce if +100 then it will display row is not found & if it is other than 0 & 100 it will raise the error
The equivalent IF command:
IF (sqlcode>= 0)
continue
ELSE
IF (sqlcode = 100)
Display 'row not found'
Else
raise an error
END-IF
END-IF.
Few notes.
Only one WHEN branch is chosen per execution of the EVALUATE, and the checking of the WHEN branches is done from top to bottom.
If none of the WHEN branches can be chosen, and a WHEN OTHER phrase exists, the WHEN OTHER branch is executed.
If none of the WHEN branches can be chosen, and there is no WHEN OTHER phrase, the EVALUATE simply terminates.
Hope it will helpful |
|