IKJEFT01 is TSO.
I think you may need a little more understanding of NULL. Anything outside of DB2 would not comprehend NULL values as defined in DB2. When DB2 shows a value as NULL, it is based upon an indicator (the null indicator). There actually is data of some kind in the column. After all, every byte must have some value; something between x’00’ and x’FF’. It is only the NULL indicator that tells DB2 the column is NULL. Once the data is outside of DB2, you will have to be very careful. There is something in that column. Even inside DB2, when you retrieve a column that is set to NULL, there is data in the column. That is why you must always check the null indicator in a program. And that is why in SQL you must always use WHERE column IS (or is not) NULL.
Now the flat file. There is something in the field that came from the nullable column. It may be nondisplayable on your terminal or nonprintable on your printer. But there is something in every byte; something between x’00’ and x’FF’. There is no NULL character.
To look at the values In ISPF editor, try issuing HEX ON.
Or print the file with IDCAMS or IEB…
Remember, you will have to check the null indicator in your SQL query and treat the columns that are NULL in some sort of special manner before writing to a flat file.
If you use DB2’s sample unload program the NULL indicator will be output to your flat file.