Page 1 of 1

Best way to seek a string pattern in a member and

PostPosted: Fri Apr 30, 2010 2:43 pm
by oldnick
Best way to seek a string pattern in a member and then return the found string ?

I need to do this and I'm realy lost between all the possibilities, I have read about FIND and SEEK in macros, ISRSUPC, SuperC and some REXX scripts to find strings but I have no idea what to use.

I need to find a string representing a dataset member, like x.y.z(m) inside a dataset member

Basically what I mean is that I need to find an "x.y.z(m)" string pattern in a member, then return the complete found string like "abc.def.rexx(fgh)"

I have read about Picture Strings in edit macros which could help define the string pattern but i don't know how to return a value from an edit macro

Has anyone done this ? Is it even possible ?

Thanks

Re: Best way to seek a string pattern in a member and

PostPosted: Fri Apr 30, 2010 6:13 pm
by oldnick
Alright guys I might be onto something:

/* REXX */
address ISREDIT
"MACRO PROCESS"
"(MYPROC) = FIND P'APP===========(========)'"
ADDRESS ISPEXEC "VPUT MYPROC"
"END"
exit


and then in an other REXX:

ADDRESS ISPEXEC "VGET MYPROC"
ADDRESS ISPEXEC "EDIT DATASET('"MYPROC"') MACRO(EDITMAC)"


Would this work ? (I'm still at the writing logic on paper stage)

Re: Best way to seek a string pattern in a member and

PostPosted: Fri Apr 30, 2010 6:18 pm
by oldnick
P'APP=============(========)' is because my member would be "APP.xxxx.yyyyyyy(zzzzzzzz)"

Re: Best way to seek a string pattern in a member and

PostPosted: Fri Apr 30, 2010 7:11 pm
by enrico-sorichetti
that' s quite a generic pattern You are searching for!
cannot be done in a simple way
maybe using the regular expression approach..
if You search the net for "doug nadel regexp"
You will be taken to
http://www.sillysot.com/ftp/findrx.txt
and
http://www.sillysot.com/ftp
for the whole set of Doug' s goodies

Re: Best way to seek a string pattern in a member and

PostPosted: Fri Apr 30, 2010 7:20 pm
by oldnick
Thanks awesome I'll try this :)