Query/400 generates default values like when using JDFTVAL in an LF or on OPNQRYF. An SQL query generates the NULL value.
To get the SQL to match the *QRYDFN, the selection in the SQL WHERE clause, fields compared against literals or fields, must be changed to use IFNULL(field, DEFAULT). I am sure the DEFAULT kwd is not accepted there, so specify the default according to the default specification in the field of the file. I suppose the same may be required for joined on fields.? The SELECT list will have to use IFNULL(field, DEFAULT) for presentation as well, if the NULL value should be replaced; VALUE() and COALESCE() are available instead of IFNULL().