|
There is a record in the file has a value in FIELD2 that cannot be converted to number. Fix the data or try below: UPDATE FILE SET FIELD2 = substr('0000000000'||trim(field2), length(trim(field2))+1, 10) where length(trim(FIELD2)) < 10 AND FIELD1 IN ('NYC1','NYC2') -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of donna lester Sent: Thursday, November 09, 2006 4:27 PM To: RPG programming on the AS400 / iSeries Subject: Character in CAST argument not valid Does any one see any issue with below SQL ? I keep getting error "Character in CAST argument not valid." UPDATE FILE SET FIELD2 = digits((Cast(FIELD2 as dec(10)))) where length(trim(FIELD2)) < 10 AND FIELD1 IN ('NYC1','NYC2') Character in CAST argument not valid. donna lester <donna_lester_ny@xxxxxxxxx> wrote: Character in CAST argument not valid. I keep getting above error though I checked spelling of field in CAST several times, spelling is perfect. Donna rick baird wrote: Donna, update FILE set FIELD2 = digits(dec(substr(FIELD2, 1, 10))) where FIELD1 IN ('NYC1','NYC2') and subst(FIELD2,11,8) = ' ' On 11/9/06, donna lester wrote:
Alan thanks , I want to update only those fields that are less than 10
in length.
And I want to place leading zeroes to make it as 10 char in length. I dont want to touch the values of FIELD2 if the length of FIELD2 is
10 or more than that.
Donna. Alan Shore wrote: Donna - be careful. There have been a few like suggestions, but my question to you is what do you want to do if the value in the field FIELD2 is longer than 10 characters? I believe in one of your earlier posted you said that FIELD2 is 18 characters. Alan Shore NBTY, Inc (631) 244-2000 ext. 5019 AShore@xxxxxxxx rpg400-l-bounces@xxxxxxxxxxxx wrote on 11/09/2006 03:06:02 PM:Rick Thanks But I want to update , not for display. I want to update FIELD2 with leading zeroes there by making it as 10
char value(wherever FIELD2 is less than 10 char) for FIELD1 in ('NYC1','NYC2') Donna rick baird wrote: Donna, try: select digits(dec(field2,10,0)) as field2 from FILE where FIELD1 IN ('NYC1','NYC2') On 11/9/06, donna lester wrote:Thanks a lot Buck for your posting. I apologize I made a mistake in my posting, FIELD2 is defined as 18char.select FIELD2 from FILE where FIELD1 IN ('NYC1','NYC2'). I want to update FIELD2 with leading zeroes there by making it as 10 char value(wherever FIELD2 is less than10 char) for FIELD1 in ('NYC1','NYC2')Donna Buck wrote:select digits(FIELD2) from FILE where FIELD1 IN ('NYC1','NYC2')This does nt work for me. I want to update FIELD2 with leading zeroes wherever it finds a value less than 10 digits.It sounds like FIELD2 is already a numeric field. If that's the case, then it is already stored with leading zeroes. Perhaps you're really looking for a way to _present_ the value of FIELD2, so that the presentation includes leading zeroes? What are you using to see the value of FIELD2? Debug? A display
file?
A report? DSPPFM? UPDDTA? --buck -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailinglistTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. Thanks, Donna. --------------------------------- Want to start your own business? Learn how on Yahoo! Small
Business.
-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailinglistTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailinglistTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. Thanks, Donna. --------------------------------- Want to start your own business? Learn how on Yahoo! Small Business. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailinglistTo post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. Thanks, Donna. --------------------------------- Access over 1 million songs - Yahoo! Music Unlimited. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
-- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. Thanks, Donna. --------------------------------- Check out the all-new Yahoo! Mail beta - Fire up a more powerful email and get things done faster.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.