View previous topic :: View next topic
|
Author |
Message |
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
why not,
during the manual edit session,
on command line:
x all 'your string'
delete all x
save. |
|
Back to top |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Front end mean ISPF panels? |
|
Back to top |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
sure. I will try tommrow in my morning time and get back with whatever i tried.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
/* 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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
add this to MYMACRO
ADDRESS ISREDIT MACRO
do spend some time with the manuals. |
|
Back to top |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
please give some link more information about isredit |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
Is I need to keep macro in seperate dataset ? |
sigh, separate member of your pds. |
|
Back to top |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
nothing is working with me.... could you please tell someother approch. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Srinivasarangam Warnings : 1 New User
Joined: 01 Jun 2010 Posts: 39 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
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 |
|
|
|