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

Member retrieval from PDS as per selection and JCL change


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Thu Mar 06, 2008 2:45 am
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

Global Moderator


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

PostPosted: Thu Mar 06, 2008 2:56 am
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: 8797
Location: Welsh Wales

PostPosted: Thu Mar 06, 2008 7:55 am
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
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

Global Moderator


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

PostPosted: Thu Mar 06, 2008 9:45 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Mar 07, 2008 1:12 pm
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
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

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

Global Moderator


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

PostPosted: Tue Mar 11, 2008 1:34 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Mar 11, 2008 1:44 am
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: 8797
Location: Welsh Wales

PostPosted: Tue Mar 11, 2008 1:10 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts 3270 personal communications. Can't c... TSO/ISPF 2
No new posts SELECT from data change table DB2 5
No new posts Trying to change copybook in online c... CICS 4
No new posts How to copy the -1 version of a membe... TSO/ISPF 4
No new posts Searching for a member but don't know... TSO/ISPF 6
Search our Forums:

Back to Top