How to set a column value to Null in an existing data record on a table using RC/Update
search cancel

How to set a column value to Null in an existing data record on a table using RC/Update

book

Article ID: 227834

calendar_today

Updated On:

Products

RC/Update for DB2 for z/OS

Issue/Introduction

How to set a column value to Null in an existing data record on a table using RC/Update for Db2 for z/OS (RCU).
The contents of the column on a particular data record may need to be set to nulls.

Resolution

Consider this table structure:

TABLE NAME         CREATOR  COLUMN NAME  COLTYPE   LENGTH N
TBEMPM             authid
                            EMPID        INTEGER        4 Y
                            DEPTID       CHAR           8 Y
                            SALARY       DECIMAL        9 N
                            BONUS        DECIMAL        9 Y


The DEPTID column is able to accept NULL values since that is how it was created. If a field accepts null values, then an extra prefix (N) will be displayed
next to the column name heading on the display of data.

This prefix is the Null Indicator as can be seen on "N:DEPTID" below. It denotes if the field is currently set to Null (Y) or not (N).

Sample display of editing data stored on table authid.TBEMPM in column mode.

For Table   => authid.TBEMPM                  > Row number=> 1 OF 8
Edit Mode   => C                                 Max Char  => 070
SSID: ssid ---------------------------------------------------------- authid
OPT S N:EMPID          N:DEPTID   SALARY        N:BONUS
___   N          1,000 N 1000----          5.99 N          5.99
___   N          2,000 N 1000----          5.99 N          5.99
___   N          3,000 N 1000----          5.99 N          5.99
___   N          4,000 N 1000----          5.99 N          5.99
___   N          5,000 N 1000----          5.99 N          5.99
___   N          6,000 Y --------          5.99 N          5.99
___   N          7,000 Y --------          5.99 N          5.99
___   N          8,000 Y --------          5.99 N          5.99


Enter a value in DEPTID column for EMPID 6000. The value 2000 has been added below.

For Table   => authid.TBEMPM                   > Row number=> 1 OF 8
Edit Mode   => C                                 Max Char  => 070
SSID: ssid ---------------------------------------------------------- authid
OPT S N:EMPID          N:DEPTID   SALARY        N:BONUS
___   N          1,000 N 1000----          5.99 N          5.99
___   N          2,000 N 1000----          5.99 N          5.99
___   N          3,000 N 1000----          5.99 N          5.99
___   N          4,000 N 1000----          5.99 N          5.99
___   N          5,000 N 1000----          5.99 N          5.99
___   N          6,000 Y 2000----          5.99 N          5.99
___   N          7,000 Y --------          5.99 N          5.99
___   N          8,000 Y --------          5.99 N          5.99

enter and the "N" column has changed from "Y" to "N" and the "S" column now has a "U" indicating a pending update. 

For Table   => authid.TBEMPM                   > Row number=> 1 OF 8
Edit Mode   => C                                 Max Char  => 070
SSID: ssid ---------------------------------------------------------- authid
OPT S N:EMPID          N:DEPTID   SALARY        N:BONUS
___   N          1,000 N 1000----          5.99 N          5.99
___   N          2,000 N 1000----          5.99 N          5.99
___   N          3,000 N 1000----          5.99 N          5.99
___   N          4,000 N 1000----          5.99 N          5.99
___   N          5,000 N 1000----          5.99 N          5.99
___ U N          6,000 N 2000----          5.99 N          5.99
___   N          7,000 Y --------          5.99 N          5.99
___   N          8,000 Y --------          5.99 N          5.99

Changing the "N" column from "N" to "Y" nulls the value previously entered.

For Table   => authid.TBEMPM                   > Row number=> 1 OF 8
Edit Mode   => C                                 Max Char  => 070
SSID: ssid---------------------------------------------------------- authid
OPT S N:EMPID          N:DEPTID   SALARY        N:BONUS
___   N          1,000 N 1000----          5.99 N          5.99
___   N          2,000 N 1000----          5.99 N          5.99
___   N          3,000 N 1000----          5.99 N          5.99
___   N          4,000 N 1000----          5.99 N          5.99
___   N          5,000 N 1000----          5.99 N          5.99
___ U N          6,000 Y 2000----          5.99 N          5.99
___   N          7,000 Y --------          5.99 N          5.99
___   N          8,000 Y --------          5.99 N          5.99

enter and the value of DEPTID for EMPID 6,000 has been set to nulls. 

For Table   => authid.TBEMPM                   > Row number=> 1 OF 8
Edit Mode   => C                                 Max Char  => 070
SSID: ssid ---------------------------------------------------------- authid
OPT S N:EMPID          N:DEPTID   SALARY        N:BONUS
___   N          1,000 N 1000----          5.99 N          5.99
___   N          2,000 N 1000----          5.99 N          5.99
___   N          3,000 N 1000----          5.99 N          5.99
___   N          4,000 N 1000----          5.99 N          5.99
___   N          5,000 N 1000----          5.99 N          5.99
___ U N          6,000 Y --------          5.99 N          5.99
___   N          7,000 Y --------          5.99 N          5.99
___   N          8,000 Y --------          5.99 N          5.99