View previous topic :: View next topic
|
Author |
Message |
sakrat
Active User
Joined: 05 Feb 2014 Posts: 164 Location: India
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
|
|
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 |
|
|
TheMFKid
New User
Joined: 20 Nov 2013 Posts: 91 Location: India
|
|
|
|
I guess you may not need all those ALLOC, EXECIO and FREE statements in your program. |
|
Back to top |
|
|
|