Best way to seek a string pattern in a member and



IBM's Command List programming language & Restructured Extended Executor

Best way to seek a string pattern in a member and

Postby oldnick » Fri Apr 30, 2010 2:43 pm

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
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby oldnick » Fri Apr 30, 2010 6:13 pm

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)
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby oldnick » Fri Apr 30, 2010 6:18 pm

P'APP=============(========)' is because my member would be "APP.xxxx.yyyyyyy(zzzzzzzz)"
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Fri Apr 30, 2010 7:11 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

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

Postby oldnick » Fri Apr 30, 2010 7:20 pm

Thanks awesome I'll try this :)
oldnick
 
Posts: 19
Joined: Wed Apr 21, 2010 1:09 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post