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
 

 

Member retrieval from PDS as per selection and JCL change

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
mfarien

New User


Joined: 02 Mar 2007
Posts: 17
Location: USA

PostPosted: Thu Mar 06, 2008 12:25 am    Post subject: Member retrieval from PDS as per selection and JCL change
Reply with quote

Hi,

I have 2 tasks here.

1.
I need to search a PDS for members and identify the ones which I have to change. My search is thru 3.14 where I look for the JOBS containing a PGM name , say NOB, I get 1100 members.
Now in the same PDS I search for JOBS containing PGM name, say NEM, I get 400 members. I have to make a change in all the JOBS which are not having NEM but DO have NOB. So in my case I have to change 700 JOBS ( 1100-700).
What would be the best way to get a listing of JOBS according to that condition ? I have tried my knowledge , but can not proceed any further.

2.
When I get this listing ( 700 JOBS ) I need to add a step (6 lines) before the existing LAST step in the JOB ( always before the last step) . Here the last step is ABEND. So just before the ABEND step I need to insert those 6 lines ( same lines for all the JOBS )

Abend steps are like this and there are more then one abend steps in the job, but always the last step is an ABEND step executing PGM=USERABND

ABEND3 EXEC PGM=USERABND
ABEND2 EXEC PGM=USERABND
JS07ABND EXEC PGM=USERABND

Thanks in advance if we can work thru it.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Mar 06, 2008 2:45 am    Post subject: Reply to: Member retrieval from PDS as per selection and JCL
Reply with quote

OK. Isn't step 1 just a matter of looking for duplicates in a list and eliminating them?

The first search finds 1100 members for NOB. If you then search only those 1100 members for NEM, then the result is those members which contain both NOB and NEM. Combine the lists, eliminate the duplicates, and you're left with just the 700 members containing NOB without NEM.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Mar 06, 2008 2:56 am    Post subject: Reply to: Member retrieval from PDS as per selection and JCL
Reply with quote

Step 2 sounds a little harder, since it seems logical that you'll have to read each member into an array, find where the last step occurs, and then insert your code immediately before that point, and write the entire updated member out. Then, repeat for each member.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Mar 06, 2008 7:55 am    Post subject:
Reply with quote

Put your six lines into a member in the PDS

You could probably use one EDIT macro to do it all including the logic for seeing if the member has the correct program combination ...
Code:

F 'PGM=NOB' FIRST
Rcx = RC
F 'PGM=NEM' FIRST
Rcy = RC
If Rcx = 0 & Rcy = 4 Then do
  F 'EXEC PGM=' LAST
  (CRSLINE,CRSCOL) = CURSOR
  COPY member BEFORE crsline
End


Not syntactically correct, but enough to get the job done with a little effort by yourself.
Back to top
View user's profile Send private message
mfarien

New User


Joined: 02 Mar 2007
Posts: 17
Location: USA

PostPosted: Thu Mar 06, 2008 9:43 pm    Post subject:
Reply with quote

OK, Where I am going to write the EDIT macro or which manual I should look to find more information on using the macros, writing, and using. Since morning I was looking to find about it, but any direction will help.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Mar 06, 2008 9:45 pm    Post subject: Reply to: Member retrieval from PDS as per selection and JCL
Reply with quote

z/OS V1R9.0 ISPF Edit and Edit Macros.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Mar 07, 2008 1:12 pm    Post subject:
Reply with quote

I don't usually post too much code these days, but having already done something very similar ..... If I have the code and it can be changed in seconds then I am happy to post. ..... Just amended my current version, and
have Not tested it

Obviously in batch you will need to allocate all of the required ISPF libraries.

1) Main REXX EXEC
Code:

 /* REXX *** LIST PDS AND INVOKE EDIT MACRO TO UPDATE MEMBERS         */
                                                                       
 Address Ispexec "Control Errors Return"                               
 Pds = "pds name"
 mac = 'UPDATPD1'
 x = msg('off')
 x=outtrap(list.)
 "LISTDS '"Pds"' MEM "
 x=outtrap(off)
 Do aa = 7 to list.0
  "Ispexec edit dataset('"Pds!!"("!!Strip(list.aa)!!")') MACRO("mac")" 
 End                           


The Macro
Code:

/* REXX *** ISPF EDIT MACRO      */ 
Address Ispexec "Control Errors Return"
"ISREDIT MACRO"
"ISREDIT F 'PGM=NOB' FIRST"
Rcx = RC
"ISREDIT F 'PGM=NEM' FIRST"
Rcy = RC                                 
If Rcx = 0 & Rcy = 4 then do             
  "ISREDIT F 'PGM=' LAST"               
  "ISREDIT (CRSLINE) = " CURSOR         
  "ISREDIT COPY member BEFORE "CRSLINE   
End                                     
Back to top
View user's profile Send private message
mfarien

New User


Joined: 02 Mar 2007
Posts: 17
Location: USA

PostPosted: Mon Mar 10, 2008 10:14 pm    Post subject:
Reply with quote

Thanks for your help, but I am struck, I am trying my best to learn it, understand it and then do it, spending time in learning thru manuals.

I am able to execute the first macro, I have a Say statement in it, in the same PDS I kept 7 other members which should be modified with my 6 lines of code, when I run it, I see this Say statement 8 times. But no msgs from my main macro in which I have my search logic and a Copy to add 6 lines from a member. I have a say statement at start of my Main macro, but getting no display from it.

I think I am doing something wrong in executing. If you can spare some time, please respond.

I am executing it using this command, and I have not done any other setup( do I need to do ? )
TSO EXEC 'the-name-of-the-PDS(member-name)' EXEC .

I have tried looked into the manual as suggested above and also few manuals from IBM site.
I think as a beginner I need to start with understanding the fundamentals of how to execute. As a programmer I can understand the loops, passing variables and logic, but the setup pertaining to REXX and flow of calls etc I need to learn.

I got this from IBM site, description is very much to what I need to do but not the language specific keywords

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ISPZEM60/2.4.3?DT=20070722183423

Here is my code first code

Code:
/* REXX *** LIST PDS AND INVOKE EDIT MACRO TO UPDATE MEMBERS         */
                                                                       
 ADDRESS ISPEXEC "CONTROL ERRORS RETURN"                               
 PDS = 'V02173.ALL.NOBNEM'                                           
 MAC = 'MAINCODE'                                                     
 X = MSG('OFF')                                                       
 X=OUTTRAP(LIST.)                                                     
 "LISTDS 'V02173.ALL.NOBNEM' MEM "                                   
 X=OUTTRAP(OFF)                                                       
 DO AA = 7 TO LIST.0                                                   
   SAY "CALLING MAINCODE MACRO"                                       
  "ISPEXEC EDIT DATASET('V02173.ALL.NOBNEM!!') MACRO("MAC")"         
 END


And another code

Code:

/* REXX *** ISPF EDIT MACRO      */             
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"         
"ISREDIT MACRO"                                 
SAY "INSIDE MAINCODE MACRO"                     
"ISREDIT F 'PGM=NOB' FIRST"                 
RCX = RC                                         
"ISREDIT F 'PGM=NEM' FIRST"                 
RCY = RC                                         
IF RCX = 0 & RCY = 4 THEN DO                     
  "ISREDIT F 'PGM=' LAST"                       
  "ISREDIT (CRSLINE) = " CURSOR                 
  "ISREDIT COPY LINES2AD BEFORE "CRSLINE         
END       
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue Mar 11, 2008 1:34 am    Post subject: Reply to: Member retrieval from PDS as per selection and JCL
Reply with quote

I'm confused. Isn't 'V02173.ALL.NOBNEM' supposed to be a PDS? If so, don't you need the member name in your loop?

Code:

...
DO AA = 7 TO LIST.0                                                   
   SAY "CALLING MAINCODE MACRO"                                       
  "ISPEXEC EDIT DATASET('V02173.ALL.NOBNEM!!') MACRO("MAC")"         
END


Shouldn't it be:

Code:

...
DO AA = 7 TO LIST.0                                                   
   SAY "CALLING MAINCODE MACRO FOR MEMBER" STRIP(LIST.AA)
  "ISPEXEC EDIT DATASET('"PDS"("STRIP(LIST.AA)")') MACRO("MAC")"         
END


Personally, I'd scale the REXX exec down a bit:

Code:

/* REXX *** LIST PDS AND INVOKE EDIT MACRO TO UPDATE MEMBERS */
PDS = 'V02173.ALL.NOBNEM'
MAC = 'MAINCODE'                                                       
"ISPEXEC LMINIT DATAID(DID) DATASET('"PDS"') ENQ(SHR)"                 
"ISPEXEC LMOPEN DATAID("DID") OPTION(INPUT)"                           
DO FOREVER                                                             
  "ISPEXEC LMMLIST DATAID("DID") OPTION(LIST) MEMBER(MEMB)"           
  IF RC <> 0 THEN LEAVE                                               
  SAY "CALLING MAINCODE MACRO FOR MEMBER" MEMB                         
  "ISPEXEC EDIT DATASET('"PDS"("STRIP(MEMB)")') MACRO("MAC")"         
END                                                                   
"ISPEXEC LMCLOSE DATAID("DID")"                                       
EXIT 0                                                                 
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10255
Location: italy

PostPosted: Tue Mar 11, 2008 1:44 am    Post subject: Reply to: Member retrieval from PDS as per selection and JCL
Reply with quote

here is a link to a working tested snippet

http://ibmmainframes.com/viewtopic.php?t=28732&highlight=apply

and another

http://www.ibmmainframes.com/viewtopic.php?t=25947&highlight=apply
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Mar 11, 2008 1:10 pm    Post subject:
Reply with quote

The macro must be in a library defined in your SYSEXEC and / or SYSPROC allocations.
You can see these by entering TSO ISRDDN on your screen.
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 -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Browsing member from any PDS shiitiizz CLIST & REXX 7 Wed Mar 08, 2017 1:17 am
No new posts Bind plan as a member to another bind... rexx77 DB2 0 Thu Feb 16, 2017 2:02 am
No new posts Fail to change physical VSAM filename... jacobdng CICS 7 Fri Jan 20, 2017 12:36 pm


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