-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Barbara Morris
Sent: Friday, June 20, 2008 1:58 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Handling decimal data errors at the field level
<snip>
(I'm sure there are much more direct ways to figure out which fields are
bad in a file. I think even CPYF can do it, if you force it to do a
mapping from packed to zoned, or zoned to packed.)
If you wanted a quick and dirty way to check, wouldn't SQL work?
Create table goodtbl as (select * from badtbl) with data
Since goodtbl is SQL defined, it won't allow bad data to be written, I'm pretty sure the escape
message will given you the record and field with the problem.
Only problem with this is that to find all the errors you'd have to keep trying the statement after
fixing each error one at a time.
If you wanted a list of problems, SQL might still provide an answer. Some thoughts:
--Create the goodtbl as above except WITH NO DATA.
--CPYF FMTOPT(*MAP) ERRLVL(*NOMAX)
I think that would give you a message for each problem record/field.
If not, I think you might be able to do it with an RPGLE or SQLRPGLE program. Still going to want a
DDL defined GOODTBL....then maybe read into a DS and write from the DS. Or use SQL to try to insert.
HTH,
Charles Wilt
--
Software Engineer
CINTAS Corporation - IT 92B
513.701.1307
wiltc@xxxxxxxxxx
This e-mail transmission contains information that is intended to be confidential and privileged. If you receive this e-mail and you are not a named addressee you are hereby notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so is prohibited and may be unlawful. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please delete and otherwise erase it and any attachments from your computer system. Your assistance in correcting this error is appreciated.
As an Amazon Associate we earn from qualifying purchases.