|
The *best* way I can think of to do this is as follows (no time to do the actual code atm lol) Scan the comment field for digit 0-9. when found Check for the closest preceding blank , that marks the start of the "invoice" number. Check the 12th position from there, if the character is anything valid character(a-z) or numeric(0-9) then it's not an "invoice" If the 12th character is not a-z or 0-9 then then preceding 11 characters ARE an invoice number. Thanks, Tommy Holden -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of steema@xxxxxxxxxxxxx Sent: Monday, January 30, 2006 2:14 PM To: RPG programming on the AS400 / iSeries Subject: Re: Scanning for numerics in a comment field If I just would like all words, is that where you use FOR ENDFOR I would want everything bet. each blanks, every word. Rather than to do lookups. this is new to me. > OK This is really what is needed. If I can just take every word in the > comments, that is either only numbers, or a combo (alpha and numerals). > > Bec. invoices sometimes have letters in them. > > SO in your idea, I would have to load 26 letters and 0-9. > > But then I'll get other words. > > That may not be so bad already since this is used to chain against in a > later process. But for esthetics, I would be interested to do it more > correct. > > >> As I said, the method is old. I am sure there are better ways today. >> >> Essentially, >> 1) define an array of 11 elements. The elements are "#012356789" >> 2) define an array of 40 elements. >> >> Fill the 40 element array with the comment. Use those elements, one at >> a time, to do a lookup in the 11 element. >> >> steema@xxxxxxxxxxxxx wrote: >>> Booth, I wasn't able to make use of your excellent idea. is the string >>> to >>> be a CONSTANT? >>> I am coding it now the slow way, but can always change. >>> >>>> The array that you would do your lookup against would be "#0123456789" >>>> then. Every time you read a '#' you would start a new record, and >>>> continue that record until you received a blank. >>>> >>>> steema@xxxxxxxxxxxxx wrote: >>>>> On further review, I need to look for the character # that follows >>>>> the word 'invoice', then take the string that follows this, as in >>>>> this >>>>> case: >>>>> INVOICE # XKC02G146L >>>>> >>>>> that is the standard, then I can code for the deviant cases. >>>>> >>>>> if it is easier I guess I can just look for '#' and forget about >>>>> 'invoice' >>>>> >>>>> >>>>>> http://tinyurl.com/9ehns >>>>>> >>>>>> This is from 1998, so there are no doubt better ways today, but it >>>>>> shows >>>>>> a way to eliminate all of the characters except the ones you list in >>>>>> a >>>>>> constant. >>>>>> >>>>>> Essentially you can define a 40-element array of 1-character each. >>>>>> Then >>>>>> do a for/endfor loop, reading and saving digits. When I find a >>>>>> digit >>>>>> I >>>>>> start a new record. If i am reading digits and find anything but a >>>>>> digit, then the record is done. That way I can have several invoice >>>>>> numbers per 40-char. comment. >>>>>> >>>>>> >>>>>> >>>>>> steema@xxxxxxxxxxxxx wrote: >>>>>>> On further relection, it is ok if there are 'wrong' invoice numbers >>>>>>> in >>>>>>> this mix. >>>>>>> I have a comment field of 40 that will have some valid invoice >>>>>>> numbers, >>>>>>> and maybe non-valids like a phone number. >>>>>>> >>>>>>> I just want to wade through this 40 pos. field and pick up all >>>>>>> contiguous >>>>>>> numerics. I won't even be concerned about the X before it, I can >>>>>>> add >>>>>>> this >>>>>>> if I want. >>>>>>> >>>>>>> The purpose here is to speed up a process by aggregating these >>>>>>> invoice >>>>>>> numbers. >>>>>>> >>>>>>> I am seeking the most elegant and efficient way to do this. >>>>>>> >>>>>>> Thanks, >>>>>>> Steve >>>>>> -- >>>>>> ----------------------------------- >>>>>> Booth Martin >>>>>> http://martinvt.com >>>>>> ----------------------------------- >>>>>> -- >>>>>> 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. >>>>>> >>>>>> >>>> -- >>>> ----------------------------------- >>>> Booth Martin >>>> http://martinvt.com >>>> ----------------------------------- >>>> -- >>>> 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. >>>> >>>> >>> >> >> -- >> ----------------------------------- >> Booth Martin >> http://martinvt.com >> ----------------------------------- >> -- >> 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. > >
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.