|
Ahhh, parsing. Well, you are going to want to build your string as you go, so your output string is going to have to be varying, or that is the easiest way anyway. It should not be that difficult actually. One way of doing it would be: parsing_keyword = *Off output_string = '' current_keyword = '' character_pos = 1 do until end of input_string if char_at_pos = '~' if parsing_keyword get replace value for keyword add replaced value to output_string parsing_keyword = *off else parsing_keyword = *On endif else if parsing_keyword keyword = keyword + char_at_pos else output_string = output_string + char_at_pos endif endif character_pos = character_pos + 1 enddo HTH, Regards, Jim Langston -----Original Message----- From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On Behalf Of Buck Calabro Sent: Wednesday, August 01, 2001 6:32 AM To: RPG400-L@midrange.com Subject: Ideas for parameters that are lists? [PROC] Hi! I have a string parsing problem that I'd like to apply some intelligence against. Input is a single string and output is a list of keywords. This is similar to extracting a list of words from a sentence, except that not all the words are "interesting". Further, I am going to perform substitutions on the resulting list, replacing the original keyword with a variable-length value. An example: GET 1234567890 (~PHONE_NPA~) ~PHONE_EXCH~-~PHONE_NUMB~$DONE$ will become GET 1234567890 (518) 555-1212$DONE$ I'm leaning toward three procedures in a loop like this: dow rc=FOUND eval rc=findKwd(inpString: outPosition: outKwd) eval rc2=substValue(inpKwd: outValue) eval rc2=replKwdWithValue(inpValue: inpPosition: updString) enddo Opinions? Buck Calabro Commsoft; Albany, NY Visit the Midrange archives and FAQ at http://www.midrange.com "The foolish and the dead alone never change their opinions" -- James Russell Lowell +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.