8 28 6 IS and ISNOT Operator

LANSA Technical

8.28.6 *IS and *ISNOT Operator

You can use the *IS and the *ISNOT operators to perform type testing of component reference variables. The following code fragment illustrates the syntax of these operators:

#Variable1 *IS #ClassName
#Variable2 *ISNOT *NULL
 

The *IS operator is used to test the class of the supplied variable, checking if the type of the variable or one of its ancestors matches the type identified by the class name.

The *ISNOT operator is used to test the class of the supplied variable, checking if the type of the variable or one of its ancestors does not match the type identified by the class name.

Both operators can also be used to test if the variable is a null reference.

Example

The following code fragment shows the use of the *IS and *ISNOT operators:

...
DEFINE_COM CLASS(#DEPTMENT) NAME(#DEPARTMENT)
SET COM(#COM_OWNER) PSCENARIO('if cond(#DEPARTMENT *IsNot *null))')
SET COM(#PASS) VALUE(FALSE)
IF COND(#DEPARTMENT *IsNot *null)
SET COM(#PASS) VALUE(TRUE)
ENDIF

SET COM(#COM_OWNER) PSCENARIO('if (#DEPARTMENT *IS #DEPTMENT)')
 (#ReferenceOne.Left <= 0))
SET COM(#PASS) VALUE(FALSE)
IF (#DEPARTMENT *Is #DEPTMENT)
SET COM(#PASS) VALUE(TRUE)
ENDIF

IF (((#DEPARTMENT *IsNot *null) *AndIf (#DEPARTMENT *Is #DEPTMENT)) *OrIf (#ADDRESS1 *Is *null))
SET COM(#PASS) VALUE(TRUE)
ENDIF
...
 

Ý 8.28 Enhanced Expressions