Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

EDIT Dataset inside macro

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Tue Apr 29, 2014 11:00 pm    Post subject: EDIT Dataset inside macro
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: 1738
Location: Bloomington, IL

PostPosted: Wed Apr 30, 2014 12:25 am    Post subject:
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

Senior Member


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

PostPosted: Wed Apr 30, 2014 2:29 am    Post subject: Reply to: EDIT Dataset inside macro
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    Post subject: Re: EDIT Dataset inside macro
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP - JCL failed while passing FTP co... Suneetha1612 JCL & VSAM 12 Wed Nov 16, 2016 7:33 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm
No new posts Allocate dataset withour BLKSIZE Susanta CLIST & REXX 2 Thu Sep 22, 2016 11:51 am
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us