Skip to main content Skip to complementary content

About nulls

Transformation allows for the processing of managing nulls on buffers I, B, O, W, V. This means that a field part of this buffer can have the null value respected, affected, or tested.

Information noteWarning: Managing null is conditioned to an option that needs to be specified at the beginning of the transformation: Option NULL_SUPPORT 

This option is added by default to new transformations and it does not affect the existing transformations unless this option is added to the first line.

For the remaining part of this section, you need to check the transformations for which the NULL_SUPPORT option is defined. If it is not defined, the word null, for instance, is forbidden.

Affecting fields with null processing

In the case of a null buffer I field, it will contain either blanks if it is of the alpha type, or 0 if it is numerical. 

The fact that it is null is recorded and transmitted when affected to another field.

Information noteWarning: Only buffer I fields (Input) B (Before, O (Output), W, and V. (Work) support the null property.

Examples: 

O.LIBELLE = I.LIBELLE

If the value of I.LIBELLE is null and is affected to O.LIBELLE, then the value of O.LIBELLE becomes null as well and the field is empty as it is an alpha-type field.

W.LIBELLE = I.LIBELLE
O.LIBELLE = W.LIBELLE

If the I.LIBELLE field is null and affected to W.LIBELLE, then W.LIBELLE becomes null. 

And as W.LIBELLE is affected to O. LIBELLE, then O LIBELLE also becomes null.

Affecting the null value

It is now possible to force a null field :

Example:

O.LIBELLE = Null

If the field is an alpha type, its content is left blank and its null property is affected.

If the field is a numerical type, its content reverts to 0 and its null property is affected.

It is possible to affect null to all the fields (databases on another field) for the I., B., O., W., V buffers.

Calculating numerical fields with null value

After addition or subtraction of two fields, they both need to be null in order for the result to be null as well.

Example:

Option NULL_SUPPORT
 
  W.VAL1 = 1
  W.VAL2 = Null
  W.VAL3 = W.VAL1 + W.VAL2
  TRACE W.VAL3

Trace: 1

After the multiplication or division of both fields, with only one being null, the entire result becomes null.

Example:

Option NULL_SUPPORT
 
  W.VAL1 = 1
  W.VAL2 = Null
  W.VAL3 = W.VAL1 * W.VAL2
  TRACE W.VAL3
Trace: 0 and Null

Test of Null value

It is possible to test whether a field is null or not.

 Example:

If I.LIBELLE = Null Then GoTo *SKIP 
If I.LIBELLE = Null Then
     I.LIBELLE = 'N/A' 
EndIf
O.LIBELLE = I.LIBELLE 
If I.LIBELLE <> Null Then
    O.LIBELLE = I.LIBELLE 
Else
    O.LIBELLE = 'N/A' 
  EndIf

Only the tests = and <> are possible, and the keyword Null can only be defined as a second factor. 

Therefore you can use IF Null=I.LIBELLE Then command.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!