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

how to exec rexx for all member library in one exec?


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

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Sat Apr 25, 2015 1:20 am
Reply with quote

hi all

i'm a problem with exec a rexx,

how to exec rexx for all members in library (100 members) and put output in sequential file?

actuality my rexx work fine for each member submit and create one output, but for 100 or 200 member i want exec once for all member and create one output in one sequential file for all member...


input member A

Code:
WIAX8 name lastname 3495555555 SI


output A

Code:
WIAX8 name lastname


input member B

Code:
APP2 name lastname 34988887555 SI


output B

Code:
APP2 name lastname


but i want for only once exec all member and create on output in one sequential file

in one output:

Code:
WIAX8 name lastname
APP2 name lastname



it's possible?? any sample please...

thanks
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Apr 25, 2015 1:45 am
Reply with quote

see here how to apply an edit macro to all the members of PDS
www.ibmmainframes.com/viewtopic.php?t=25947&highlight=

it is trivial to substitute the EDIT invocation with the invocation of a REXX script
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Sat Apr 25, 2015 3:02 pm
Reply with quote

thanks for answer Enrico, it's all new for me...

i'm create this rexx

Code:
/* rexx */                                                               
/* get name owner from jobname in member*/                                     
say 'start rexx'                                                               
/*----------------------------------------------------------------------------*/
/* FILEINP = app name (member) it's parm in jcl */                             
/*----------------------------------------------------------------------------*/
address tso "execio * diskr fileinp (stem fileinp. finis"                       
 if rc>0 then exit 12                                                           
 out = 0                                                                       
do in=0 to fileinp.0                                                           
    IF substr(fileinp.in,1,3) = VFY THEN DO                                     
      owner = substr(fileinp.in,1,40)                                           
      out=out+1                                                                 
      filowner.out = 'OWNER Jobname: 'owner                                     
      filowner.0   = out                                                       
      say ' - OWNER Jobname:' owner                                             
    end                                                                         
end                                                                             
/*----------------------------------------------------------------------------*/


member WIAX8 input PAMR=WIAX8:

Code:
WIAX8P01  name lastname                  55555555 SI                     
WIAX8P02  name lastname 2                 33344454 SI


output with PAMR=WIAX8:

Code:
WIAX8P01  name lastname                                                   
WIAX8P02  name lastname 2                                                       


member WIAX10 input PAMR=WIAX10:

Code:
WIAX10P1  name lastname 1                222222222 SI                     
WIAX10P2  name lastname 2                77777777 SI


output with PAMR=WIAX10:

Code:
                                                                         
WIAX10P1  name lastname 1                                                       
WIAX10P2  name lastname 2                                                       


but now,

how to in one exec the rexx get input all members in library and create one output sequential

MY.LIBRARY.APP (100 members)
WIAX8
WIAX10
MILA1
MILB1

one output for all memebers

Code:
                                                                         
WIAX8P01  name lastname                                                         
WIAX8P02  name lastname 2                                                       
WIAX10P1  name lastname 1                                                       
WIAX10P2  name lastname 2                                                       
MILA1P01  name lastname                                                         
MILA1P02  name lastname 2                                                       
MILB10P1  name lastname 1                                                       
MILB10P2  name lastname 2                                                       


i'm create this rexx but i'm not sure work...

Code:
                                                                         
/* REXX */                                                                     
A = OUTTRAP('MEMBLIST.')                                                       
"LISTDS (MY.LIBRARY.APP) MEMBERS"                                               
A = OUTTRAP(OFF)                                                               
                                                                               
 DO i = 4 TO MEMBLIST.0                                                         
  MEMBER = STRIP(MEMBLIST.i)                                                   
   IF substr(MEMBER,1,8) = MEMBER THEN DO                                       
    "ALLOC FILE(MEMBER) DSNAME('"MY.LIBRARY.APP"("MEMBER")') SHR"               
       IF rc <> 0 THEN DO                                                       
         SAY 'Error read member' MY.LIBRARY.APP'('MEMBER')'                     
         EXIT                                                                   
       END                                                                     
         "EXECIO * DISKR MEMBER (STEM LINEA."                                   
                                                                               
          out = 0                                                               
          do in=0 to LINEA.0                                                   
            IF substr(LINEA.in,1,3) = VFY THEN DO                               
               owner = substr(LINEA.in,1,40)                                   
               out=out+1                                                       
               filowner.out = 'OWNER Jobname: 'owner                           
               filowner.0   = out                                               
               say ' - OWNER Jobname:' owner                                   
            end                                                                 
          end                                                                   
                                                                               
        SAY MEMBER 'elaborate'                                                 
        "EXECIO 0 DISKR MEMBER (FINIS"                                         
        "FREE FILE(MEMBER)"                                                     
        "EXECIO 1 DISKR MEMBER (STEM LISTA."                                   
   END                                                                         
 END                                                                           
                                                                               
 EXIT                                                                           


any ideas?

thanks again
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Mon Apr 27, 2015 8:54 pm
Reply with quote

First, I'd suggest you look at the contents of the memberlist. stem variables. Next, your code
Code:
DO i = 4 TO MEMBLIST.0                                                         
   MEMBER = STRIP(MEMBLIST.i)                                                   
    IF substr(MEMBER,1,8) = MEMBER THEN DO                                       

needs some thought. I don't think it's what you want.

memberlist.0 contains the number of line returned by OUTTRAP, so you need to loop through the memberlist. stem variable based on this count - but be aware that not all lines returned refer to members.

Garry
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Mon Apr 27, 2015 9:34 pm
Reply with quote

1. I think you can eliminate the second EXECIO by combining with the first EXECIO (add the FINIS).

2. I think you can eliminate the third EXECIO altogether. It is destined to fail because you FREE the DD name just prior to it.

3. You have gathered your output in the filowner. stem, but you have not written it out yet. You need a new EXECIO that writes the stem.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Wed Apr 29, 2015 10:16 am
Reply with quote

thanks for answer , this is a code ...work fine

but I read your advice and suggestions

Code:
/* REXX */                                                             
/* dsn input */                                                         
   ARG mylib                                                           
/* create list members names */                                         
A = OUTTRAP('MEMBLIST.')                                               
"LISTDS '"mylib"' MEMBERS"                                             
A = OUTTRAP(OFF)                                                       
                                                                       
out = 0                                                                 
DO i = 7 TO memblist.0 /* start from record 7 */                       
   memberinp = STRIP(memblist.i)                                       
   /* open member */                                                   
   "ALLOC FILE(MEMBER) DSNAME('"mylib'('memberinp')'"') SHR"           
   IF rc <> 0 THEN DO                                                   
                                                                       
      SAY 'Error open memberinp' mylib'('memberinp')'                   
      EXIT                                                             
   END                                                                 
     "EXECIO * DISKR MEMBER (STEM LINEA." /* read emberinp */           
    SAY 'member name: 'memberinp 'elaborate'                           
 /* out = 0 */                                                         
    DO in=2 to linea.0 /* start record 2 */                             
      IF SUBSTR(linea.in,1,3) = 'VFY' THEN DO /* only VFY */           
      if substr(linea.in,1,4) = 'VFY=' then iterate  /* exclude VFY= */
         owner = SUBSTR(linea.in,5,51) /* record save */               
         out = out+1                                                   
         filowner.out = owner                                           
         filowner.0   = out                                             
         SAY ' - Owner:' owner                                         
      END                                                               
   END                                                                 
                                                                       
   "EXECIO 0 DISKR MEMBER (FINIS" /* close memberinp elaborate */       
   "FREE FILE(MEMBER)"                                                 
END                                                                     
                                                                       
"EXECIO * DISKW FILOWNER (FINIS STEM FILOWNER."                         
    SAY 'last: 'memberinp 'elaborate'                                   
    SAY 'records out: 'out /* total records */                         
                                                                       
 EXIT


MY.LIBRARY (100 members)
WIAX8
WIAX10
MILA1
MILB1

one output for all members

Code:
WIAX8P01  name lastname                                                         
WIAX8P02  name lastname 2                                                       
WIAX10P1  name lastname 1                                                       
WIAX10P2  name lastname 2                                                       
MILA1P01  name lastname                                                         
MILA1P02  name lastname 2                                                       
MILB10P1  name lastname 1                                                       
MILB10P2  name lastname 2


thanks again for all.
Back to top
View user's profile Send private message
italo_pm

New User


Joined: 26 Mar 2015
Posts: 37
Location: Italy

PostPosted: Mon May 04, 2015 11:18 am
Reply with quote

hi everyone, i'm extract record interesting... then modified records, now, how to insert a new record into the members??

first delete old record?? and after insert new record when only find VFY rule , but how to read all record for each name app... in my output app name is from colum 1 to colum 5 (not for all member)...

any ideas or suggestions please.

thanks

best regards.
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top