To Execute this Example
Method A
Use process SET_231 and choose option “(A) Access a file with null capable fields” to maintain data on a file with null capable fields using method A. Whenever you insert fields containing blank or zero, the data will be stored on the OS/400 file object as null (X’00’). Note that the first field is the unique key for this file, so only one record on the file can contain null for this field.
Method B
Use process SET_231 and choose option “(B) Access a file with null capable fields” to maintain data on a file with null capable fields using method B. Whenever you want to put null (X’00’) into a field, set the associated null flag field to Y, before insert/update. The field will be set to null regardless of its own contents, and the next time it is read from the file it will contain the default value.
Access a File with Null Capable Fields | The Things that Make Up this Example |
Method A
Use process SET_231 and choose option “(A) Access a file with null capable fields” to maintain data on a file with null capable fields using method A. Whenever you insert fields containing blank or zero, the data will be stored on the OS/400 file object as null (X’00’). Note that the first field is the unique key for this file, so only one record on the file can contain null for this field.
Method B
Use process SET_231 and choose option “(B) Access a file with null capable fields” to maintain data on a file with null capable fields using method B. Whenever you want to put null (X’00’) into a field, set the associated null flag field to Y, before insert/update. The field will be set to null regardless of its own contents, and the next time it is read from the file it will contain the default value.