Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 
Find the last occurance of a string in a member.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Fri Dec 10, 2010 1:20 am    Post subject: Find the last occurance of a string in a member.
Reply with quote

Hi all,

Is there any command in Rexx, which works as the TSO command, "F last 'search string' "

I want to locate the last occurance of a string in a PDS member and write the entire record in a PS(output) file.

Is there any way to find this, without reading the entire PDS member.??

Thank you.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Fri Dec 10, 2010 2:11 am    Post subject: Reply to: Find the last occurance of a string in a member.
Reply with quote

No there is not.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1772
Location: Bloomington, IL

PostPosted: Fri Dec 10, 2010 2:29 am    Post subject:
Reply with quote

Note that edit macros need not be written in Rexx, although they can be.

I recommend that you write such a macro that moves the cursor to the end of the member and then executes a FIND PREV.
Back to top
View user's profile Send private message
John L. McConnell

New User


Joined: 10 Dec 2010
Posts: 11
Location: Orlando, FL

PostPosted: Fri Dec 10, 2010 5:06 am    Post subject:
Reply with quote

The short answer has already been given. But the good news is that there is a fairly fast way, even if it does involve the unavoidable reading of the entire member.
The edit macro suggestion is probably the best way. It would need to be implemented in the context of an algorithm that uses LMMLIST or LISTD pdsname M to produce a member list. You would loop through the member list and ALLOC each member. Then you would invoke EDIT on each member and capture the record found with a FIND LAST.
If that seems daunting, once you have allocated the member, you can do an EXECIO * DISKR on it into a stem variable, such as mem. Fou can actually loop through the records backwards with DO I = mem.0 to 1 by -1. Then in the loop: x = LASTPOS("string",mem.I)
IF x \= 0 then [capture the record and leave the loop]. This is the equivalent of doing a max down and FIND PREV in EDIT. I hope that helps.
Back to top
View user's profile Send private message
bhagyac

New User


Joined: 17 Apr 2008
Posts: 44
Location: bangalore

PostPosted: Fri Dec 10, 2010 3:37 pm    Post subject:
Reply with quote

Thanks a lot to everybody..
i followed John's suggestion. It worked.. icon_biggrin.gif

Thanks to you all!!!
Back to top
View user's profile Send private message
r2k1984

New User


Joined: 21 Jun 2005
Posts: 69
Location: chennai

PostPosted: Mon Dec 20, 2010 3:02 pm    Post subject:
Reply with quote

***************************** Top of Data ****************
/* REXX */
SAY " STRING TO BE SEARCHED" WRITE
ADDRESS ISREDIT
"MACRO "
PULL A
"F .ZL"
"F PREV " A
J1 = "//"USERID()"$ JOB MSGCLASS=X,MSGLEVEL=(1,1),CLASS=B,
J2 = "// REGION=5M,NOTIFY=&SYSUID"
'ISREDIT LINE_AFTER 0 = (J1)'
'ISREDIT LINE_AFTER 1 = (J2)'
**************************** Bottom of Data **************


Below macro to be placed in your ispf macro and you can execute the code and it will work
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Dec 20, 2010 3:19 pm    Post subject:
Reply with quote

Surely
Code:
"ISREDIT F '"string"' LAST"
would suffice
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2069
Location: Silicon Valley

PostPosted: Mon Dec 20, 2010 8:20 pm    Post subject: Reply to: Find the last occurance of a string in a member.
Reply with quote

Code:
"F .ZL"
"F PREV " A

I think you will not find the text on hthe very last line.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1032
Location: Oostende, Belgium

PostPosted: Mon Dec 20, 2010 11:59 pm    Post subject:
Reply with quote

Code:
"l .zl"
icon_cool.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm
No new posts Command to find TMEMBER name for a TPIPE Siva NKK Kothamasu IMS DB/DC 0 Wed Aug 16, 2017 6:08 pm
No new posts change string before sertan string anatol DFSORT/ICETOOL 8 Tue Aug 15, 2017 5:43 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us