Method A
Method A is to assume that:
However, virtual field logic needs to be added to the C specs for writing to the OS/400 file object to recognize when a default value is being written, and in that case to indicate to the OS/400 file object that a null value is to be used. LANSA functions read from and write to the file without any special processing, except that if the null capable field is a key field, they can’t position to a key value of null (FETCH with_key(null), UPDATE with_key(null) DELETE with_key(null) etc).
Choose “Calculations before output to file” (C Specs) and paste in the virtual field logic given. See Method A Virtual Field logic
Save and compile the file and ensure that the 3 conditions at the beginning have been met.
Access a File with Null Capable Fields | To Execute this Example | The Things that Make Up this Example |
Method A is to assume that:
- If a field is numeric, the null value (X’00’) in the field on the OS/400 file object is equivalent to the default value (usually zero) for the field in the LANSA function.
- If a field is character, the null value (X’00’) in the field on the OS/400 file object is equivalent to the default value (usually blanks) in the field in the LANSA function.
However, virtual field logic needs to be added to the C specs for writing to the OS/400 file object to recognize when a default value is being written, and in that case to indicate to the OS/400 file object that a null value is to be used. LANSA functions read from and write to the file without any special processing, except that if the null capable field is a key field, they can’t position to a key value of null (FETCH with_key(null), UPDATE with_key(null) DELETE with_key(null) etc).
Choose “Calculations before output to file” (C Specs) and paste in the virtual field logic given. See Method A Virtual Field logic
Save and compile the file and ensure that the 3 conditions at the beginning have been met.