You are here: DBG/400>DBG400 Web>CvtNulFld (18 Aug 2009, MartinRowe)EditAttach

CvtNulFld - Convert Null fields

Details

CvtNulFld - Convert Null fields. This utility was designed to work with my CRTCSVDTA tool which cannot (yet) handle null capable fields that are set to the null value. Just point the command at a file and it will convert any fields with null values to the appropriate non-null default, zero, blank or minimum date/time values. The resultant data can then be copied to a .csv streamfile by CRTCSVDTA without problems. Of course, you can use it for any other purpose that requires the removal of null values. Remember that the utility converts the data in situ, so you may want to run it over a copy of the file for CRTCSVDTA use.

It works by dumping the list of fields in the target file to a user space via the QUSLFLD API. The user space is then parsed and for each null-capable field an SQL statement is built up which converts all occurrences of that field with a null value to the non-null default. The SQL statement is executed via my EXCSQL as 1) it doesn't require SQLRPG(LE) precompiler support on your AS/400 (iSeries, i5, etc), and 2) I don't use embedded SQL as yet wink

download Download

zip cvtnulfld.zip (14Kb).

This is packaged in Craig Rutledge's XMLGEN xml installer. See installation instructions for details.
Topic revision: r3 - 18 Aug 2009 - 22:22:00 - MartinRowe
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback