nullsub()

The nullsub() function substitutes the variable with a default value if the variable specified by the first parameter is null:

Example of the nullsub Function Translation
Service Manager function Translated SQL equivalent:
  select ps.number, ps.title from probsummary ps where nullsub (ps.openen.by, “falcon”)=”falcon”
select t01.”NUMBER”, t01.”TITLE” from PROBSUMMARYM1 t01 where COALESCE (t01.”OPENED_BY”, ‘falcon’) = ‘falcon’

The first parameter can only be a field name or an expression that can be evaluated beforehand, it cannot be an expression that cannot be evaluated before translation into SQL. The other parameters can only be constant numbers or expressions that can be evaluated to numbers before translation into SQL:

The following cases are valid:
nullsub ( ps.category, “abc” )   //In this example, “category” is a field from file “probsummary”
nullsub ( $L.var, “abc” )  //In this example, $L.var is a local variable defined beforehand.
The following cases are invalid:
nullsub ( ps.title + ps.brief, “abc” )
nullsub ( ps.title + $L.var, “abc” )