× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



My answer posted to Midrange list.

-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Nick W Mart
Envoyé : mercredi 21 janvier 2009 16:21
À : RPG programming on the IBM i / System i
Objet : Re: SQL String to numeric conversion

I have more information regarding my previous question. Here is a sample of the actual data field.

....+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+... INFO TO PRINT $1.59- $.00 $1.59- $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $33.60- $.00 $33.60- $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 !
$.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00 $.00 $.00 $.00 $.00$.00We came up with the following SQL statement that gave us 2 totals.select sum(decimal(replace((substring(fldname,1,17)),'$',''),9,2,'.')) FROMfilename WHERE recid = '3' GROUP BY substring(fldname,18,1)If there is something that would be better, we would appreciate thesuggestions.Nick Mart----- Original Message -----From: "Nick W Mart" <nickmart@xxxxxxxxxxxxxxx>To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>Sent: Wednesday, January 21, 2009 8:07 AMSubject: SQL String to numeric conversion> If I have a value of "$38.54-" in a text field is there a way that youknow of in sql so that I can do a sum on all records?>> Thank you in advance.>> Nick Mar!
t> --> This is the RPG programming on the IBM i / System i (RPG400-L)
mailinglist> To post a message email: RPG400-L@xxxxxxxxxxxx> To
mailinglist> subscribe, unsubscribe, or change list options,> visit:
mailinglist> http://lists.midrange.com/mailman/listinfo/rpg400-l> or
mailinglist> email: RPG400-L-request@xxxxxxxxxxxx> Before posting,
mailinglist> please take a moment to review the archives> at
mailinglist> http://archive.midrange.com/rpg400-l.>---------------------
mailinglist> -----------------------------------------------------------
mailinglist> No virus found in this incoming message.Checked by AVG -
mailinglist> http://www.avg.comVersion: 8.0.176 / Virus Database:
mailinglist> 270.10.10/1905 - Release Date: 1/20/20092:34 PM
--
This is the RPG programming on the IBM i / System i (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.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.