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

ISREDIT macro command doubt


IBM Mainframe Forums -> TSO/ISPF
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Wed Feb 05, 2014 6:47 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Wed Feb 05, 2014 6:49 pm
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Wed Feb 05, 2014 6:59 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Feb 05, 2014 10:07 pm
Reply with quote

Are you saying that the cursor does not move after the second FIND?

Show us your macro.
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Fri Feb 07, 2014 12:57 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 07, 2014 1:20 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Fri Feb 07, 2014 2:06 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Fri Feb 07, 2014 2:08 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Fri Feb 07, 2014 2:55 pm
Reply with quote

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 icon_rolleyes.gif .

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 icon_razz.gif
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Fri Feb 07, 2014 5:16 pm
Reply with quote

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 icon_rolleyes.gif .

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 icon_razz.gif




Hi,
Thanks a lot sureshpathi.......it was really helpful for me.....i got my code executed correct...thank you so much..... icon_lol.gif icon_lol.gif icon_smile.gif
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 3:06 pm
Reply with quote

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
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Feb 11, 2014 4:23 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 5:25 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 5:29 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 5:30 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Feb 11, 2014 5:47 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Tue Feb 11, 2014 8:00 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 8:51 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Feb 11, 2014 8:58 pm
Reply with quote

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
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 9:36 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Tue Feb 11, 2014 10:12 pm
Reply with quote

Use the PARSE statement.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Tue Feb 11, 2014 10:18 pm
Reply with quote

Pedro wrote:
Use the PARSE statement.

"Use the parse, Luke!" icon_biggrin.gif
Back to top
View user's profile Send private message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Feb 11, 2014 10:19 pm
Reply with quote

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
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Tue Feb 11, 2014 11:34 pm
Reply with quote

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:
Code:
DSN=my.pds(A12)

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Feb 11, 2014 11:47 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF Goto page 1, 2, 3  Next

 


Similar Topics
Topic Forum Replies
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
No new posts Routing command Address SDSF to other... TSO/ISPF 2
No new posts DTL - how to define key with stacked ... TSO/ISPF 3
No new posts LTJ command CA Products 4
No new posts Query on edit primary command CLIST & REXX 5
Search our Forums:

Back to Top