View previous topic :: View next topic
|
Author |
Message |
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi all,
I am creating a rexx macro now and for that i am using isredit find command to find the particular string in a jcl and getting the dataset by using the string....but now what happened is the string is present in more than one more place so each time when the string is found it should get the dataset and move it to the stem variable...i found the string once and now the string is present in line number 12 and i have to move my cursor position to line number 12 from the present cursor position which is 6....how can i move the cursor position after each find statement....
Title de-emphasised |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
unfortunately nobody does URGENT around here
if You have time constraints a forum is not the best place to ask for help
and ... do not use CAPS in the title of the topic, it' s like shouting |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
how can i move the cursor position after each find statement |
How do you do it when you are normally editing a dataset. Have you referred to the macro manual? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Are you saying that the cursor does not move after the second FIND?
Show us your macro. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
First of all Sorry for giving the subject in caps...i have been trying to find out the solution for 2 days regarding but dint get a solution....
Code: |
/*REXX*/
"ISREDIT MACRO"
TRACE (?R)
TEMP="NEW,CATLG,DELETE"
I=1
"ISREDIT SEEK ALL '"TEMP"'"
"ISREDIT (COUNT) = SEEK_COUNTS"
SAY COUNT
DO WHILE COUNT > 0
IF RC=0 THEN DO
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT CURSOR = "VAL1" 1"
"ISREDIT (LINE) = LINE .ZCSR"
INPUT.I = STRIP(LINE)
PARSE VALUE "'"INPUT.I"'" WITH PREC ','
OUT=POS('=',PREC)
RES=SUBSTR(PREC,OUT+1)
OUTPUT.I=RES
"ISREDIT FIND NEXT '"TEMP"'"
COUNT=COUNT-1
END
"ISREDIT END" |
here is my macro.....after the FIND NEXT command.....when the loop again starts the cursor position is in the same place it dint move to next position after the string is again present......
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
COUNT is controlling your loop. How do you feel there is a connection between COUNT (a Varible) and FIND?
To put it another way, when you FIND what happens to COUNT? Nothing.
It is good to use the trace and post it.
Work on your indentation. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
I have COUNT here as loop since it will tell the number of times the string is present and so the process of finding the string and performing operation on that line will happen according to the number of the times the string is present....Now how can i move the cursor to the next line where the string is again present what code should i write for that after the NEXT FIND syntax line.... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Pedro wrote: |
Are you saying that the cursor does not move after the second FIND?
Show us your macro. |
/*REXX*/
"ISREDIT MACRO"
TRACE (?R)
TEMP="NEW,CATLG,DELETE"
I=1
"ISREDIT SEEK ALL '"TEMP"'"
"ISREDIT (COUNT) = SEEK_COUNTS"
SAY COUNT
DO WHILE COUNT > 0
IF RC=0 THEN DO
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT CURSOR = "VAL1" 1"
"ISREDIT (LINE) = LINE .ZCSR"
INPUT.I = STRIP(LINE)
PARSE VALUE "'"INPUT.I"'" WITH PREC ','
OUT=POS('=',PREC)
RES=SUBSTR(PREC,OUT+1)
OUTPUT.I=RES
"ISREDIT FIND NEXT '"TEMP"'"
COUNT=COUNT-1
END
"ISREDIT END" |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Hi... I guess you are trying to get list of Datasets that are getting created in the JOB.
Code: |
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT CURSOR = "VAL1" 1" |
Because of the above statement, Cursor move to Previous line and when you issue "FIND NEXT", it will go the same line again and again. If you haven't specified loop based on count, it would've been a infinite .
When you use "FIND" command in your EXEC, its better to avoid change the place of cursor.
if you want to get the previous line data, you can easily get by LINENUM.
So, remove
Code: |
"ISREDIT CURSOR = "VAL1" 1"
"ISREDIT (LINE) = LINE .ZCSR" |
and code
Code: |
"ISREDIT (LINE) = LINE " VAL1 |
Hope this helps |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
sureshpathi10 wrote: |
Hi... I guess you are trying to get list of Datasets that are getting created in the JOB.
Code: |
"ISREDIT (VAL) = LINENUM .ZCSR"
VAL1=VAL-1
"ISREDIT CURSOR = "VAL1" 1" |
Because of the above statement, Cursor move to Previous line and when you issue "FIND NEXT", it will go the same line again and again. If you haven't specified loop based on count, it would've been a infinite .
When you use "FIND" command in your EXEC, its better to avoid change the place of cursor.
if you want to get the previous line data, you can easily get by LINENUM.
So, remove
Code: |
"ISREDIT CURSOR = "VAL1" 1"
"ISREDIT (LINE) = LINE .ZCSR" |
and code
Code: |
"ISREDIT (LINE) = LINE " VAL1 |
Hope this helps |
Hi,
Thanks a lot sureshpathi.......it was really helpful for me.....i got my code executed correct...thank you so much..... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Hi
I want to find the string "NEW,CATLG,DELETE" or ",CATLG,DELETE" in a jcl...How do i write the syntax using the find command to find either this or that..... |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Swathi Muralidharan wrote: |
Hi
I want to find the string "NEW,CATLG,DELETE" or ",CATLG,DELETE" in a jcl...How do i write the syntax using the find command to find either this or that..... |
"isredit find 'either this or that'" |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
prino wrote: |
Swathi Muralidharan wrote: |
Hi
I want to find the string "NEW,CATLG,DELETE" or ",CATLG,DELETE" in a jcl...How do i write the syntax using the find command to find either this or that..... |
"isredit find 'either this or that'" |
Sorry i count understand what you wrote....
I have taken TEMP="NEW,CATLG,DELETE" and TEMP2 = ",CATLG,DELETE"
if in this i have find all either TEMP or TEMP2
then do i need to write like this
"ISREDIT FIND ALL '"TEMP"' OR '"TEMP2"' "
Is my above syntax correct.....?????
If not please provide me the right syntax..... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Swathi Muralidharan wrote: |
prino wrote: |
Swathi Muralidharan wrote: |
Hi
I want to find the string "NEW,CATLG,DELETE" or ",CATLG,DELETE" in a jcl...How do i write the syntax using the find command to find either this or that..... |
"isredit find 'either this or that'" |
Sorry i count understand what you wrote....
I have taken TEMP="NEW,CATLG,DELETE" and TEMP2 = ",CATLG,DELETE"
if in this i have find all either TEMP or TEMP2
then do i need to write like this
"ISREDIT FIND ALL '"TEMP"' OR '"TEMP2"' "
Is my above syntax correct.....?????
If not please provide me the right syntax..... |
I am getting error for the above syntax of ISREDIT.....please help me with the right syntax for that.... |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
I have taken TEMP="NEW,CATLG,DELETE" and TEMP2 = ",CATLG,DELETE"
if in this i have to find all either TEMP or TEMP2 and have a count of all those and perform operations
so I wrote like this
"ISREDIT FIND ALL '"TEMP"' OR '"TEMP2"' "
bu i am getting error in this line....please help me with the right code for this.... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
"ISREDIT FIND ALL '"TEMP"' OR '"TEMP2"' "
bu i am getting error in this line....please help me with the right code for this.... |
You should realize that just whining about getting an error is only a waste of time for everybody
unless You post more useful info ...
the EXACT code snippet
the EXACT error You received
and a trace of the execution of the relevant statements
Your chances of getting help are pretty slim |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
FIND does not support a syntax of finding two different strings. You have to find each of string1 then start over at the top and find each of string2. |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Pedro wrote: |
FIND does not support a syntax of finding two different strings. You have to find each of string1 then start over at the top and find each of string2. |
Hi,
Yes i found that and used two different call statement to call each time like when it finds temp1 it calls one program and when it finds temp2 it calls the other program.
But now i want to find whether the dataset which i am finding is a GDG or a ps file...if it is GDG then i have to iterate through the loop.
is there any syntax to find the character in a line....please help with that....
My idea is to find whether the dataset is GDG or ps is if that dataset contains "(" or ")" then i can determine that it is a GDG so that i will iterate through the loop.
can someone help me giving some idea regarding that..... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
Quote: |
My idea is to find whether the dataset is GDG or ps is if that dataset contains "(" or ")" |
and only if the thing between parentheses is a number
it could be a PDS with a member specified ( SOME.PDS(MEMBER) ) |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
Yes you are right if i find the character between "(" and ")" i can find whether it is numeric or character using DATATYPE syntax...but how do I find the character between both the paranthesis......?????? |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Use the PARSE statement. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Pedro wrote: |
Use the PARSE statement. |
"Use the parse, Luke!" |
|
Back to top |
|
|
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
yes wrote a syntax with PARSE statement as below :
PARSE VALUE '"RES"' WITH PRE '(' POST ')'
SAY POST
POST1=SUBSTR(POST,2)
SAY POST1
IF DATATYPE(POST1) == NUM
ITERATE
END
dont know whether this will work or not...will try this tommorow and let you know people.....
in the above code i have taken POST variable if it is a GDG it will have wither + or - sign in first position so i removed that by using SUBSTR and the checking whether it is a NUMERIC or CHARACTER...if it is NUMERIC then it shows that it is GDG and so it will iterate through the loop.
But i tried with PARSE statement earlier today for the same issue if in case it is PS file then it would not have any open or close parenthesis... then in that case i should move my dataset to the stem variable....
here in above case it will just iterate through the loop if it is GDG but what if it is a PS file......what line should i add here in the code for that.... |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
I think you should use PARSE VAR instead of PARSE VALUE.
You discard the first character of the POST variable, but I think that first character is the most important part.
Your code will fail when it is PDS like this:
It will fail because it will proceed as though it was a GDG.
Quote: |
but what if it is a PS file......what line should i add here in the code for that.... |
What happens when you try it? What is in your POST variable when you have a sequential dataset? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
installing on Your PC open object REXX available here
sourceforge.net/projects/oorexx/
will let You prototype ALL the computing logic of Your rexx scripts on Your PC |
|
Back to top |
|
|
|