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

Open PDS Member in View Mode and Execute Macro


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kisstian

New User


Joined: 06 Sep 2006
Posts: 6

PostPosted: Tue Oct 10, 2006 10:13 pm
Reply with quote

Hi. What I'm trying to do is execute a macro that will open a piece of skeleton JCL in view mode, execute a few ISPF edit commands on it and then save the member under a new name. A snippet of the code I have is as follows:

Code:
/* REXX -- CHANGE STRINGS */
"ISREDIT MACRO"
"ISPEXEC VIEW DATASET(AAA.BBB.CCC(MEMBER)')"
"ISREDIT CUT 24 31"
"ISREDIT PASTE AFTER .zlast"
"ISREDIT CRE 'DDD.EEE.FFF(MEMBER)' .zf .zl"


The problem is that the desired skeleton is opened up, but the macro does not perform anything else. It ends at that point. I have not been able to figure out how to get around this. Thanks.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Tue Oct 10, 2006 11:12 pm
Reply with quote

You have a single quote on this line:

"ISPEXEC VIEW DATASET(AAA.BBB.CCC(MEMBER)')"

Does removing it make a difference?
Back to top
View user's profile Send private message
kisstian

New User


Joined: 06 Sep 2006
Posts: 6

PostPosted: Tue Oct 10, 2006 11:33 pm
Reply with quote

No, that didn't help. That was just a typo on my part while I was testing some variations.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Oct 11, 2006 12:18 am
Reply with quote

If you use the following REXX:

Code:

/* REXX -- CHANGE STRINGS */                             
"ISREDIT MACRO"
"ISREDIT (CURRMBR) ="MEMBER
"ISREDIT CUT 24 31"                                     
"ISREDIT PASTE AFTER .ZLAST"                             
"ISREDIT CRE 'DDD.EEE.FFF("||CURRMBR||")' .ZF .ZL"       
"ISREDIT CANCEL"                                         
EXIT                                                     


This REXX should be stored in an authorized library with a specific name (like MACREXX).

Edit the library member the REXX should run against:
AAA.BBB.CCC(MEMBER)

Type MACREXX on the command line and press enter. Do not prefix with TSO. It should execute, create your new member, and cancel out of the original member without changing anything.
Back to top
View user's profile Send private message
kisstian

New User


Joined: 06 Sep 2006
Posts: 6

PostPosted: Wed Oct 11, 2006 12:50 am
Reply with quote

Looks good, but how can I invoke the macro outside of the member?
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Oct 11, 2006 1:13 am
Reply with quote

ISPEXEC and ISREDIT host command environments are only available to REXX execs that execute in ISPF.

In order to execute a MACRO with ISPEXEC and ISREDIT, you need to be in a member or dataset under ISPF.

If you do a "ISPEXEC EDIT DATASET('AAA.BBB.CCC(MEMBER)')", it places you in the right member, but you have to press END to have the REXX continue with its instructions. It fails because you are no longer in the member to do CUT/PASTE/etc.

So you can run your REXX while editing the target member or re-write your REXX to bring the contents of MEMBER into a STACK or STEM, use REXX logic to adjust it, and write the contents of your STACK or STEM back out to an alternate PDS.
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 -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts HILITE on Browse mode? TSO/ISPF 2
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Calling an Open C library function in... CICS 1
No new posts SET PATH in View DDL DB2 2
Search our Forums:

Back to Top