|
The (subjectively) fastest way to search it is to use the MEMCHR C function (which is actually an MI instruction too) and search for the '<' character, then, once you locate it, look at the next few characters for the 'pdf' string. If found, blah blah blah. The prototype for memchr is available at the RPGLAB (www.rpgiv.com/downloads) along with most other usefull C and MI instructions. -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx Sent: Thursday, November 11, 2004 11:31 AM To: rpg400-l@xxxxxxxxxxxx Subject: Searching a user space I have an xml document loaded into a user space and I want to find a specific tag. I can use the %Scan BIF but I'm looking for something that will search the entire user space at one time without having to loop and check 64k at a time. Currently I'm trying to use the C strstr function but it keeps giving me a pointer value when the search string doesn't exist in the user space. I have listed the associated code below. If anyone sees a problem with my code or has a better way I'm all ears (or eyes in this case). // Search for substring d SchStr pr * ExtProc('strstr') Error number d * Const Options(*String) String to search d * Const Options(*String) String to find // XML string being worked on d XMLString@ s * d XMLString s 64000 Based(XMLString@) d TmpPtr s * // Search constants d b_PDF s 5 Inz('<pdf ') TmpPtr = SchStr(%TrimR(XMLString) :b_PDF); Rick -- 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.