7 57 3 IF_NULL Examples

LANSA Technical

7.57.3 IF_NULL Examples

Example 1: If field #A and #C are numeric and field #B is alphanumeric then the following IF conditions are all identical (assuming none of the fields are SQL Null):

IF_NULL   FIELD(#A #B #C)
 

is identical to:

GROUP_BY  NAME(#GROUP) FIELDS(#A #B #C)
IF_NULL   FIELD(#GROUP)
 

which is identical to:

IF        COND('(#A = 0) AND (#B = *BLANKS) AND (#C = 0)')
 

which is identical to:

IF        COND('(#A = *ZERO) AND (#B = '' '') AND (#C = *ZERO)')

Example 2: Request that the user supplies values for fields #A, #B and #C. If no values are specified assume that the user wants to end the function and re-display the process's main menu:

GROUP_BY NAME(#GROUP) FIELDS(#A #B #C)
 
CHANGE   FIELD(#GROUP) TO(*NULL)
REQUEST  FIELDS(#GROUP)
 
IF_NULL  FIELD(#GROUP)
MENU     MSGTXT('Since no data entered, end of function assumed')
ENDIF