I have designed a Db2 program. I got a doubt in handling null indicators. i have declared the null indicator variable as s9(4) comp.
i have a NULL field. so while inserting and updating i have moved -1 to null indicator to insert it in db2 table.
My doubt is, whether i need to move 0 to null indicator if the column defined as NULL has a valid value ?. I have moved the value to the db2 field and 0 to the null indicator during insertion and updation?. please let me know what i have done is correct ?.
i have given a sample psuedo code which i have used in my program.
if sql-code = 0
move "valid-value" to db2 field
move "0" to null-indicator
if sql-code = 100
move -1 to null-indicator
Moreover during SUM(db2 field), this db2 field is a NULL field, whether it is necessary to use null indicators or is it enough to use host variables alone to handle the sum.