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

EDIT Dataset inside macro


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 164
Location: India

PostPosted: Tue Apr 29, 2014 11:00 pm
Reply with quote

Hi Everyone,
I have been creating a macro for inserting delete step in a JCL. Now I am trying to use that macro in a pds, like if i execute a macro in the command line of the PDS, all the jcls should inside the PDS(i.e) members should have delete step inserted.

So in this I have written a code as shown below :
Code:

/* REXX */
"ISREDIT MACRO"
TRACE(R)
"ISREDIT  (PDS) = DATASET"
"ISREDIT (MEM) = MEMBER"
X = OUTTRAP('ML.')
     "LISTDS '"PDS"' MEMBERS"
       DO I=7 TO ML.0
                 ML.I=STRIP(ML.I)
    ADDRESS ISPEXEC
                  "ALLOC DATASET('"PDS"("ML.I")') DD(IN1) SHR"
   "EDIT  DATASET('"PDS"("ML.I")') MACRO(DELSTP)"   
   "EXECIO * DISKRU IN1 (FINIS. "
   "FREE F(IN1)"
       END
X = OUTTRAP('OFF')
"ISREDIT END"


But here I am getting errors in the line alloc if i use ADDRESS ISPEXEC. So i moved that line after the ALLOC but then I am getting error like there is a user already using the dataset where it is actually me since i tried executing the macro in the command line after opening the member in edit mode.


So my requirement is I should need my macro to be executed in the command line of the PDS so that all the members(JCLS) gets the delete step inserted.

Can some please help me out in this... please.....
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Wed Apr 30, 2014 12:25 am
Reply with quote

Placing ADDRESS environment on a line by itself sends all future string not the argument of an ADDRESS instruction to that environment. ALLOCATE is not an ISPF service; it is a TSO command.

You are recursively allocating the members of the PDS(E), which is why the allocation fails.

Are you sure that you want to do this with an Edit macro rather than a script running external to edit?
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Apr 30, 2014 2:29 am
Reply with quote

My suggestion is that you should avoid the edit when member = ML.I. Just invoke %DELSTP from within your current exec.

I do not recall the details, but I am leery of EDIT DATASET while you are already editing in the dataset. I suggest using LMINIT followed by EDIT DATAID instead. You risk corrupting the directory.
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Wed Apr 30, 2014 9:05 am
Reply with quote

Swathi Muralidharan wrote:
So my requirement is I should need my macro to be executed in the command line of the PDS so that all the members(JCLS) gets the delete step inserted.

Can some please help me out in this... please.....


You cannot run an EDIT Macro in "the command line of a PDS". Edit macros can only be issued inside a member in EDIT or VIEW mode.
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Wed Apr 30, 2014 9:07 am
Reply with quote

I guess you may not need all those ALLOC, EXECIO and FREE statements in your program.
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top