I have written my own UDTF which will detect invalid numeric values (and it already existed before the SYSTOOLS-Functions).
But I do it a little different.
In my function I use SQL to read the complete table. Invalid numeric values will cause a CPF5035 Error.
... using fully dynamic SQL (with Descriptor Areas) in (embedded) SQL is a little tricky.
After having read the complete file I search the job log for CPF5035 messages. These messages provide all necessary information.
Unfortunately, I cannot give out for free, but just in case you are interested contact me directly (Hauser@xxxxxxxxxxxx)
But you could do it manually, i.e. first read the complete table with ACS and then use the JOBLOG_INFO table function to find the CPF5035 messages.
The other option is, to write an UDTF also based on a dynamic SELECT-Statement that will return the Error Messages.
The WHERE conditions with TRY_CAST can be prepared dynamically based on the SYSCOLUMNS information.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to. " (Richard Branson)
"Learning is experience … everything else is only information!" (Albert Einstein)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Richard Schoen
Sent: Tuesday, 15 July 2025 21:45
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: RE: SYSTOOLS.VALIDATE_DATA issues?
Thanks for the response.
I was hoping VALIDATE_DATA was a little more encompassing for a single table to catch all errors for me in the first pass.
All the docs I've read seem to imply that it will return a list of ALL invalid columns. That's how I would expect it to work as well.
I'll have a deeper look at the source, but it's not the cleanest SQL function and definitely not over-documented 😊
In your cast example would you have to manually create an SQL statement for each table ?
I'm trying to have something more automated that goes thru a table one time and tells me where my bad columns are located.
Thanks again for your input.
Regards,
Richard Schoen
Web:
http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx
----------------------------------------------------------------------
message: 1
date: Tue, 15 Jul 2025 08:35:50 +0200
from: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
subject: RE: SYSTOOLS.VALIDATE_DATA issues?
Yep, that's correct. When I talked with Scott Forstie about that he mentioned that I to run it multiple times (after having corrected the wrong contents).
But the function is in the SYSTOOLS library, so you can get the source code, modify it and create your own function based on your modification.
For to detect or correct invalid numeric values, I use the TRY_CAST function and convert the column value into a numeric value with the same definition.
If an invalid value is detected a NULL value is returned ... and NULL Values can be trapped.
Something like this
Select *
From YourFile
Where Try_Cast(Col1 as Dec(11, 1)) is NULL
Or Try_Cast(Col2 as Dec(7, 2)) is NULL
Or ...
Or Try_Cast(ColN as Dec(15, 5)) is NULL;
Mit freundlichen Gr??en / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i Database and Software Architect IBM Champion since 2020
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to. " (Richard Branson) "Learning is experience ? everything else is only information!" (Albert
Einstein)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Richard Schoen
Sent: Tuesday, 15 July 2025 07:07
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: SYSTOOLS.VALIDATE_DATA issues?
Anyone else using this to validate table data ?
I'm seeing that it's only identifying a single column even though multiple columns have bad numeric data.
Any thought s ?
Regards,
Richard Schoen
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.