IBM Support

Updating Records with NULL Value

Troubleshooting


Problem

This documents describes how to update a record that contain NULL values.

Resolving The Problem

Updating records with NULL values to default values can be done with any of these three techniques:

1Using interactive SQL (the STRSQL command), run the following statement:

UPDATE NULLFILE SET NULLCHAR = ' ' WHERE NULLCHAR IS NULL
or
UPDATE NULLFILE SET NULLDEC = 0 WHERE NULLDEC IS NULL
2If you do not have interactive SQL, do the following:

a Create a member in a text source file with one of the update statements from above. Place only one SQL statement in a source member.

b Create a query management query object from this member using the CRTQMQRY command.

c Run the query management query using the STRQMQRY command.
3Write a RPG program that reads the file that allows nulls and writes to a second file with the same record layout that does not allow nulls. Compile the program with the ALWNULL parameter as *YES. Call the program. Use CPYF to copy the second data file back to the first data file with the MBROPT(*REPLACE) option.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

392652903

Document Information

More support for:
IBM i

Software version:
6.1.0

Operating system(s):
IBM i

Document number:
706613

Modified date:
18 December 2019

UID

nas8N1015310

Manage My Notification Subscriptions