|
Rick,This is bloody brilliant! For an insolvable problem it comes very, very close. In addition to the comments about using something other than '#' there is the problem that step #5 would retrieve '2107071,' (with the comma) as an invoice number. My guess is that these comments are entered by hand, not by an automated system. Otherwise they would be standardized already. The chances of getting a handle on a foolproof process seems impossible.
* Jerry C. Adams *iSeries Programmer/Analyst B&W Wholesale Distributors, Inc.* * voice 615.995.7024 fax 615.995.1201 email jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx> rick baird wrote:
wow, what a mess. I don't see a foolproof way, but try something like this. I think this will get you all of the examples you list EXCEPT for the one listing 3 separated by commas. 1. move description to a variable length workfield (larger than the original) 2. %scan and %replace all instances of ' AND ' or ' & ' with 'INV#' 3. %scan and %replace all spaces with # 4. scan for 'INV' tick through the rest of the description byte by byte until you come apon a '#X' or '#0' through '#9' you have now found the first byte of your invoice. 5. continue ticking till you find another #. this is the end of your invoice number. 6. clear out these spaces from # to # and repeat steps 4 and 5. until end of string reached. On 1/27/06, steema@xxxxxxxxxxxxx <steema@xxxxxxxxxxxxx> wrote:Well this is the picture. Don't ask why, but we get some info from abroad. They put invoice numbers in a comment field. The comment field can have normal comment info (not invoice number) but when there is the invoice there, I need to put this in some other work file. The len. of this comment field is 40. It is not uniform. The ways it is there are: INVOICE# XKC03J143L INVOICE # XTG05K023L INVOICE # XSC06A016L INV# XKC03G091L INV. XTC05L053L INV 5400960 INVOICES XTC05F008L AND XTC05F012L (in this case, I want to write 2 records) INVOICE XTC05F009L INVOICE #'S 2107071, 2107073 & 2107079 INVOICE #'S XSC04H008L & XTC04H021L IN addition, there are several spelling mistakes on the word Invoice, but these are not my concern ( I was thinking how to take the file, run it in Microsoft spell check, perhaps someone has done this?). Any thoughts on the coding would be appreciated. Thanks, Steve INVOICES SHIPPED AFTER COST CHANGE (an example of a real comment) -- 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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.