Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Good morning. I have a file that has '40404040' in a numeric field and I'm having a heck of a time writing either a program or SQL to set them to zero. Does anyone know of a simple way to fix these records? I'd appreciate the input.
If the file is externally Described, then write a simple RPG program that reads and updates the file. That will probably fix it.
H FIXNBR(*ZONED : *INPUTPACKED) FmyFile UF E DISK /free *INLR = *ON; read myFile; dow NOT %EOF(); update myFile; // Might need record format instead read myFile; enddo; /end-free
Thanks, Bob. I compiled the program with the fixnbr parms, but wasn't updating every record. I'll give it a shot!
That did it, Bob! Thanks again!
By the way Sir, did you find the program which generated the blanks in your numeric field?
Is likely from a file defined as LVLCHK(*NO). When such as file is opened, OS400 will detect if the actual file record length is different (typically longer) than the record length defined in the compiled program object. This can happen when a new field is added to a file and programs using that new field are not recompiled. If so, OS400 pads out the shorter record length with blanks. If that uncompiled program then WRITEs a record to the file and the new file field unknown to the program is numeric, boom, the new record has blanks in the numeric field. If the new field is character, no problem, blanks are ok.
Chris R