Midrange News for the IBM i Community


Posted by: Chris Proctor
Programmer Analyst
Columbia Sports Company
Portland, OR
Fixing '40404040' in a numeric field
has no ratings.
Published: 19 Jul 2012
Revised: 23 Jan 2013 - 4109 days ago
Last viewed on: 24 Apr 2024 (5956 views) 

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.

Fixing '40404040' in a numeric field Published by: Chris Proctor on 19 Jul 2012 view comments(5)

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.

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Fixing '40404040' in a numeric field
Posted: 11 years 9 months 6 days 9 hours 33 minutes ago
Edited: Thu, 19 Jul, 2012 at 11:55:26 (4297 days ago)

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

 

 

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Fixing '40404040' in a numeric field
Posted: 11 years 9 months 6 days 9 hours 31 minutes ago

Thanks, Bob. I compiled the program with the fixnbr parms, but wasn't updating every record. I'll give it a shot!

 

Posted by: chrisp
Premium member *
Portland, OR
Comment on: Fixing '40404040' in a numeric field
Posted: 11 years 9 months 6 days 9 hours 14 minutes ago

That did it, Bob! Thanks again!

Posted by: RalphAMiller
Premium member *
Franklin, TN
Comment on: Fixing '40404040' in a numeric field
Posted: 11 years 9 months 14 hours 1 minutes ago

By the way Sir, did you find the program which generated the blanks in your numeric field? 

Posted by: Ringer
Premium member *
Comment on: Fixing '40404040' in a numeric field
Posted: 11 years 8 months 29 days 10 hours 22 minutes ago

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