| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== SETNONULL (set file field non-null) ====== | [[setlayout set window orientation .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[setnull set file field null .htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} **SETNONULL(**//field//**)** **SETNONULL(**//file, field//**)** {{blk2blue.jpg|blk2blue.jpg}} | **SETNONULL** | Assigns non-null value (blank or zero) to a //field//. | | //field// | The label (including prefix) of a field in a FILE structure. This may be a GROUP or RECORD structure. | | //file// | The label of a FILE. | The **SETNONULL** statement assigns a non-null value (blank or zero) to a //field// in a FILE structure. If the //field// is a GROUP or RECORD structure, all component fields are set non-null. Support for null "values" in a FILE is entirely dependent upon the file driver. You can now pass a file as the first parameter to **SETNONULL**. This allows you to pass references to fields (see the example below). **Return Data Type:     **LONG **Example:** **Customer  FILE,DRIVER('Clarion'),PRE(Cus)             !Declare customer file layout** **AcctKey    KEY(Cus:AcctNumber)** **Record      RECORD** **AcctNumber    LONG** **OrderNumber   LONG** **Name          STRING(20)** **Addr          STRING(20)** **            END** **          END** **Header    FILE,DRIVER('Clarion'),PRE(Hea)             !Declare header file layout** **AcctKey    KEY(Hea:AcctNumber)** **OrderKey   KEY(Hea:OrderNumber)** **Record     RECORD** **AcctNumber   LONG** **OrderNumber  LONG** **ShipToName   STRING(20)** **ShipToAddr   STRING(20)** **           END** **          END** ** CODE** ** OPEN(Header)** ** OPEN(Customer)** ** SET(Hea:AcctKey)** ** LOOP** **  NEXT(Header)** **   IF ERRORCODE()** **    BREAK** **   END** **  Cus:AcctNumber = Hea:AcctNumber** **  GET(Customer,Cus:AcctKey)                             !Get Customer record** **  IF ERRORCODE()** **   CLEAR(Cus:Record)** **  END** **  IF NULL(Hea:ShipToName) OR Hea:ShipToName = Cus:Name  !Check same ship-to address** **   Hea:ShipToName = 'Same as Customer Address'          !flag the record** **   ****SETNONULL****(Hea:ShipToAddr)                            !and blank out ship-to address** **   ****SETNONULL****(Hea:ShipToCSZ)** **  END** **  PUT(Header)                                           !Put Header record back** ** END** **!Example Two ' Use of file parameter** **SwapNullState PROCEDURE(File F, ANY var)** **  CODE** **    IF ****NULL****(f, var)** **     ****SETNONULL****(f, var)** **    ELSE** **     ****SETNULL****(f, var)** **    END** **See Also:** [[null return null file field .htm|NULL]] [[setnull set file field null .htm|SETNULL]] [[setnulls set the null state of columns .htm|SETNULLS]] [[getnulls get the null state of a table .htm|GETNULLS]]