IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Search a string and delete.


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Thu May 24, 2012 10:40 pm
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
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
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
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: 765
Location: Whitby, ON, Canada

PostPosted: Thu May 24, 2012 11:12 pm
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

Global Moderator


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

PostPosted: Thu May 24, 2012 11:15 pm
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
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

Global Moderator


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

PostPosted: Thu May 24, 2012 11:45 pm
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
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

Moderator Emeritus


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

PostPosted: Thu May 24, 2012 11:58 pm
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
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
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
Reply with quote

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

Global Moderator


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

PostPosted: Fri May 25, 2012 2:14 pm
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
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
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
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: 2454
Location: Hampshire, UK

PostPosted: Fri May 25, 2012 6:11 pm
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: 792
Location: Pennsylvania

PostPosted: Fri May 25, 2012 6:27 pm
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
Srinivasarangam
Warnings : 1

New User


Joined: 01 Jun 2010
Posts: 39
Location: India

PostPosted: Fri May 25, 2012 6:28 pm
Reply with quote

hey nic,

don't under estimate someone so easily and start passing comments....

i got the solution....

i have acheived that as below

Code:
ADDRESS "TSO"                                   
  "ALLOC DA('"INPUT0"') F(INDF) SHR REUSE"     
  "EXECIO * DISKR INDF(STEM LINES. FINIS"       
  DO I = 1 TO LINES.0                           
     IF  SUBSTR(LINES.I,7,1) <> '*' THEN       
     DO                                         
         J = J + 1                             
         A.J = 'HELLO'                         
         "EXECIO * DISKW INDF (FINIS STEM A."   
     END                                       

before writing this type of comments, please think once. No one is born intelligent... even you... I never asked anyone for code .. i requested ideas from everyone thinking you all are experts in rexx as i am very rarely work on rexx and as i don't have much exposure to rexx
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 6:32 pm
Reply with quote

not to belabor a point:
Quote:
No one is born intelligent

that is untrue.

No one is born with knowledge <<<< now that is true.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri May 25, 2012 6:34 pm
Reply with quote

Good Job. Not how I would do it, but if you say it works, then great.

You probably want to move "EXECIO * DISKW INDF (FINIS STEM A." outside of your DO I = loop however.

You are writing ALL the lines of your A. stem every time instead of just once at the end.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Fri May 25, 2012 8:10 pm
Reply with quote

Well, I may have been a bit harsh but not too much and obviously I am not particularly serious but you did say "nothing is working with me". with that amount of information how can we help you with your problem which, if you got it fixed, could well provide you with something that you can use as a foundation for future efforts? If you need to get more exposure to Rexx you can download free rexx interpreters for your pc and practice there. You would then only need to learn the bits that are specific to z/OS and ISPF e.g. EXECIO instead of the ANSI standard I/O routines.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Fri May 25, 2012 9:25 pm
Reply with quote

Maybe I am not interpreting it correctly, but
Quote:
I never asked anyone for code ..

and
Quote:
I don't have any sample code. If anyone of you have the sample, request you to share the same.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Copy only TEXT or String from a record SYNCSORT 4
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts Mark Previous & next lines when a... DFSORT/ICETOOL 9
No new posts sort to find out the char which repea... Mainframe Interview Questions 10
No new posts Help with C character vs C string All Other Mainframe Topics 3
Search our Forums:

Back to Top