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
 

 

Search a string and delete.
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu May 24, 2012 10:34 pm    Post subject: Search a string and delete.
Reply with quote

Hi all,

I am trying to search a string inside a member of PDS and once it found I want to delete that line using REXX.

I am planning to read this member first to find the line numbers where this string sits in the member by scaning the member line by line and than delete those lines. Please let me know is I am going in correct direction or any other better way is there to achieve the same.

I don't have any sample code. If anyone of you have the sample, request you to share the same.

Thanks in advance,
Venkat,
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 24, 2012 10:40 pm    Post subject:
Reply with quote

If this was a requirement just to be ment in REXX ??

SORT is much better and easier to write by using

Code:
OMIT COND/INCLUDE COND



In Rexx when ever you find those strings dont copy it

How to read a file and copy to another google EXECIO + DISKR + REXX

How to find a position of a string google POS + REXX

For your requirement try to make use of both icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 24, 2012 10:43 pm    Post subject:
Reply with quote

why not,
during the manual edit session,
on command line:
x all 'your string'
delete all x
save.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu May 24, 2012 11:02 pm    Post subject:
Reply with quote

Hey thank you ].

Here I am developing a tool which deletes the string inside members of PDS. In the front end user just enters some string and we need to delete all lines which is having this string.. this is the requirement.

i try to take your suggestions and try code in the same way.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 24, 2012 11:10 pm    Post subject:
Reply with quote

Quote:
I am trying to search a string inside a member of PDS


Quote:
inside members of PDS


It is such a joy to be a member of a professional forum
where the only ones that post questions are people
who do not specify the requirements,
or change them on every post,
or search beforehand for a solution,
one of which is asked and answered here, posted today about 9 hours ago.

Quote:
I am developing a tool

someone who know little or nothing about his environment,
is building a TOOOOOL for that environment.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 642
Location: Whitby, ON, Canada

PostPosted: Thu May 24, 2012 11:12 pm    Post subject:
Reply with quote

My advice would be to set up an ISPF edit macro that performs the sequence of commands that Dick suggested. Then you can run the macro for each member of the PDS. Easy enough to do and has been discussed many times on this forum.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 24, 2012 11:15 pm    Post subject:
Reply with quote

Front end mean ISPF panels?
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu May 24, 2012 11:32 pm    Post subject:
Reply with quote

Yes. ISPF panels.

Dick/Don,

I think whatever description i have given above is less. Sorry for the confusion. The tool will perform adding new members, updating some of email address, deleting the email address ,,,.. and many more other things. The email id given in panel may or may not be there in member. If it is there at that time we need to delete that. Updating email address with a new email address is working fine for me. I am trying to code for delete, but i am not getting idea how to achieve that. So request you all help me suggest some ideas achieve that.

Thanks,
Venkat
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu May 24, 2012 11:45 pm    Post subject:
Reply with quote

What have you tried till now ??

And did you try what others have told ?

please try them and get back with what you have tried
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Thu May 24, 2012 11:57 pm    Post subject:
Reply with quote

sure. I will try tommrow in my morning time and get back with whatever i tried....
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 24, 2012 11:58 pm    Post subject:
Reply with quote

Hello,

Possibly your "delete" routine could be your "update" code (that is already working) changed to NOT write out a new record to the output?

Not writing will effectively delete the record (providing a newmember IS being created).
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 1:13 pm    Post subject: Reply to: Search a string and delete.
Reply with quote

/* REXX */
ADDRESS ISPEXEC "EDIT DATASET('T310753.IIRS.data1') MACRO(MYMACRO)"

MYMACRO:
ADDRESS ISREDIT "X ALL '*' 7 7 "
ADDRESS ISREDIT "DELETE ALL X"
EXIT

I am trying this code for test purpose to delete all records with '*' in 7 th column in dataset 'T310753.IIRS.data1' .. but i am getting message saying MACRO not found.
Is I need to keep macro in seperate dataset ?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 25, 2012 1:16 pm    Post subject:
Reply with quote

add this to MYMACRO

ADDRESS ISREDIT MACRO


do spend some time with the manuals.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 2:10 pm    Post subject:
Reply with quote

please give some link more information about isredit
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 25, 2012 2:14 pm    Post subject:
Reply with quote

On top of the page you see IBM MANUALS link click there and it will lead to manual page and get ISPF Edit and Edit Macros
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 3:57 pm    Post subject:
Reply with quote

Code:

EDIT       T310753.IIRS.REXXLIB(TEST2) - 01.28             Columns 00001 0
Command ===>                                                  Scroll ===>
****** ***************************** Top of Data *************************
000001 /* REXX */                                                         
000002 ADDRESS ISPEXEC "EDIT DATASET('T310753.IIRS.DATA') MACRO(MYMACRO)"
000003                                                                   
000004 MYMACRO:                                                           
000005 ADDRESS ISREDIT "MACRO"                                           
000006 ADDRESS ISREDIT "X ALL '*' 7 7 "                                   
000007 ADDRESS ISREDIT "DELETE ALL X"                                     
000008 EXIT                         
Code:
COMMAND MYMACRO NOT FOUND   
***                         
Code:
EDIT       T310753.IIRS.DATA                              Macro does not exist
Command ===> MYMACRO                                          Scroll ===> CSR
****** ***************************** Top of Data *****************************
==MSG> -Warning- The UNDO command is not available until you change           
==MSG>           your edit profile using the command RECOVERY ON.             
000100 FRANK               JAN            PILOT             50000             
000200 LANGKA*M            SARAH          MECHANIC          80000             
000300 SMITH *             MICHEAL        MECHANIC          40000             
000400 WADE                KIRSTEN        PILOT             85000             
000500 TONAS               HARALD         PILOT             105000           
000600 WAUGH               TIM            PILOT             70000             
000700 LEIGHMAN            DAGMAR         MECHANIC          70000             
000800 TRETTHAWN           FRANK          PILOT             70000             
000900 TIETZ               OTTO           PILOT             70000             
001000 TONAS               HARALD         PILOT             105000           
001100 WALKER              THOMAS         MECHANIC                           
001200 NOROVIITA           JOACHIM        MECHANIC          70000             
001300 LAUFFER             CRAIG          MECHANIC          70000             
001400 TONAS               HARALD         PILOT             105000           
still getting errror please help me
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 25, 2012 4:00 pm    Post subject:
Reply with quote

Quote:
Is I need to keep macro in seperate dataset ?


sigh, separate member of your pds.
Back to top
View user's profile Send private message
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 5:50 pm    Post subject:
Reply with quote

nothing is working with me.... could you please tell someother approch.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Fri May 25, 2012 6:11 pm    Post subject:
Reply with quote

Give up, go home and on Monday start looking for a job outside of IT as you seem to have no related skills re finding things out, understanding or asking questions or giving information when asking questions.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Fri May 25, 2012 6:27 pm    Post subject:
Reply with quote

I thought you said you were looking in a 'member of a pds'.

The file you are editing is not a pds.

Also, so you understand, MYMACRO must be a separate member in your REXXLIB pds.

If you do not want to follow Nic's advice, search this forum for the many examples of invoking an edit macro from a rexx exec.

Also search for LMMLIST to see how to list members of a pds and write to a file. Or look in the manual.

Then use you brain, and say to yourself:
1) I can list the members of a pds and write to a file
2) I can read the file one record at a time using a do loop, or I can read them all into the stack and pull them one at a time in the do loop.
3) for each record (member name) I can invoke my edit macro which I have put in a separate member of my rexxlib.
4) I better not forget to put "ISREDIT END" at the end of my edit macro or it will just hang

This is not a very difficult thing to do, it just requires some effort.

If you put in the effort, and show that here on the forum, then the experts are more willing to help.
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 -> TSO/ISPF All times are GMT + 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts How to insert a lengthy string havin... vidyaa DB2 7 Thu Aug 25, 2016 5:20 pm


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