7 32 2 ELSE Examples

LANSA Technical

7.32.2 ELSE Examples

Example 1: If field #I is greater than 10 issue a message indicating this, else issue a message indicating it is less than or equal to 10:

IF       COND('#I *GT 10')
MESSAGE  MSGTXT('#I is greater than 10')
ELSE
MESSAGE  MSGTXT('#I is less than or equal to 10')
ENDIF
 

Example 2: Execute a certain series of commands if #QUANTITY is less than 10 and #MEASURE is greater than 42.67, else execute a different series of commands:

IF       COND('(#QUANTITY *LT 10) *AND (#MEASURE *GT 42.67)')
* << commands to execute when condition is true >>
ELSE
* << commands to execute when condition is false >>
ENDIF