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

populate members in PDS with REXX


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

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Fri May 13, 2011 2:21 pm
Reply with quote

i need to populate a list of members present in PDS.
Lets if i give input as 'E123456.REXX.PDS' as an input to REXX tool then it should be able to open the same PDS and populate the list of members present in it.

I have an initial idea of using OUTTRAP first and the fire some command.
like --
x = OUTTRAP('VAR.')
--- this is the place where i can fire command to populate the list of members present in the input PDS ---
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri May 13, 2011 2:36 pm
Reply with quote

'Thanks in advance' - for what? You have not asked a question!

What are you putting into these pre-existing members? What do they already contain? What command(s) were you thinking of 'firing'? What about redundancy payments for those that are fired! What Rexx tool will you be using? Are you going to write it yourself or does it already exist? Note: Rexx itself is not a tool - it is a programming language.

Probably more questions but I think you may get the idea - your post is not thought through and the information is not presented clearly for those who have no idea about what you are really attempting to do.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri May 13, 2011 2:37 pm
Reply with quote

You don't fire commands on z/OS, and although English is obviously not your native language, it wouldn't hurt not to mangle it beyond comprehension...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 13, 2011 2:41 pm
Reply with quote

my guess is that the TS given a PDS wants to get the list of the members!

there are 3 alternatives

1. The TSO command LISTDS with the MEMBERS parameter. Trap the output and process it.

2. ISPF service LMMLIST.

3 read directly with rexx the directory see here for an example www.sillysot.com/ftp/mlrexx.txt
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri May 13, 2011 2:42 pm
Reply with quote

Quote:

You don't fire commands on z/OS, and although English is obviously not your native language, it wouldn't hurt not to mangle it beyond comprehension...


<FIREWALL>
<SERVER host="local.ftpproxy.com"> </SERVER>
<FIRECMD>&REMOTE_USER;@&REMOTE_HOST;</FIRECMD>
<FIRECMD>&REMOTE_PW;</FIRECMD>
<FIREWALL

see :

publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.gim3000/opftp.htm
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 13, 2011 2:45 pm
Reply with quote

the following are two edit macros,
LISTMBRS
  • 'calls' GETMBRSR
    • uses lmm services to obtain all members of the current PDS
    • populates a variable pool item with the member names
    • returns
  • access the variable pool item and populates the current member with the pds member list


you can use the LMM services logic if you wish.

LISTMBRS
Code:

/* REXX */
  'GETMBRSR'
/*   TRACE ?R */
ADDRESS ISPEXEC VGET   (MBRLIST) SHARED
ADDRESS ISPEXEC VERASE 'MBRLIST' SHARED
ADDRESS ISREDIT
PTR = 1
LISTLEN = LENGTH(MBRLIST)
'(NUMLINES) = LINENUM' .ZLAST
IF RC <> 0 THEN
   NUMLINES = 0
DO WHILE PTR < LISTLEN
   INSERT_VALUE = '>>>>>>>' !! SUBSTR(MBRLIST,PTR,8)
   "LINE_AFTER " NUMLINES" = '"INSERT_VALUE"'"
   '(NUMLINES) = LINENUM' .ZLAST
   PTR = PTR+8
END
EXIT


GETMBRSR
Code:

/* REXX  */
ADDRESS ISREDIT 'MACRO'
/****************************************************************/
/*                                                              */
/*                                                              */
/* WILL POPULATE A VARIABLE POOL ITEM                           */
/*                    CONTAINING ALL MEMBER OF THE PDS THAT YOU */
/* ARE CURRENTLY EDITING/VIEWING                                */
/*                                                              */
/****************************************************************/
/*   TRACE ?R */
"ISREDIT ("DATA1") = DATAID"
"ISREDIT ("CURMEM") = MEMBER"
"ISREDIT ("PDSNAME") = DATASET"
/*           */
ADDRESS ISPEXEC "LMOPEN DATAID("DATA1") OPTION(INPUT)"
LMRC = RC
IF LMRC <> 0 THEN
   DO
     SAY BAD LMOPEN LMRC
     ISPEXEC "LMCLOSE DATAID("DATA1")"
     ISPEXEC "LMMLIST DATAID("DATA1") OPTION(FREE)"
     EXIT
   END
/*           */
MBRNAME= '        '
LMRC = 0
MBRLIST = ''
/*    TRACE ?R    */
DO WHILE LMRC = 0
   ISPEXEC "LMMLIST DATAID("DATA1,
           ") OPTION(LIST) MEMBER(MBRNAME,
           ) STATS(YES)"
   LMRC = RC
   IF LMRC = 0  THEN
      DO
        LENMBR  = LENGTH(MBRNAME)
        IF LENMBR < 8 THEN
           DO
             LENMBR = 8 - LENMBR
             PLUG = SPACES(LENMBR)
             MBRNAME = MBRNAME!!PLUG
           END
        MBRLIST = MBRLIST!!MBRNAME
      END
END
ISPEXEC "LMMLIST DATAID("DATA1") OPTION(FREE)"
ISPEXEC "LMCLOSE DATAID("DATA1")"
ISPEXEC "VPUT  (MBRLIST) SHARED"
EXIT
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 13, 2011 3:23 pm
Reply with quote

having tried both my method (LMM.. services) and Doug Nadel's procedure,
i find Doug's is much quicker to obtain the member names.

but on another note, here is yet again, a REXX tool to provide the function of SAVE while in an EDIT/VIEW/BROWSE member list.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri May 13, 2011 3:29 pm
Reply with quote

agree with You icon_biggrin.gif , it is nice not to depend on the ISPF environment and the OUTTRAP stuff
and here is a simplified version of Doug Nadel example processing just the names
Code:
****** ***************************** Top of Data ******************************
000001 /*rexx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000002 /*                                                                   */
000003 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
000004 Trace  "O"
000005 parse upper arg ds
000006 if listdsi(ds) \= 0 then do
000007     say "dataset '"ds"' not found"
000008     return 16
000009 end
000010 if substr(sysdsorg,1,2) \= "PO" then do
000011     say "dataset '"ds"' is not PO"
000012     return 16
000013 end
000014 Address TSO
000015 "ALLOC FI(DD) DA("DS") SHR REUS DSORG(PS) RECFM (F B) LRECL(256)"
000016 "EXECIO * DISKR DD ( STEM DIR. FINIS"
000017 "FREE FI(DD)"
000018 do idir = 1 to dir.0
000019    blk = substr(dir.idir,3,c2d(left(dir.idir,2))-2)
000020    do while blk \= ""
000021       parse var blk mbr 9 ttr 12 usr 13 .
000022       if mbr = 'ffffffffffffffff'x then ,
000023          leave idir
000024       say "==> " mbr
000025       blk = delstr(blk,1,c2d(bitand(usr,'1f'x))*2+12)
000026    end
000027 end
****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Fri May 13, 2011 3:47 pm
Reply with quote

Hi enrico, you guessed right !

Its working absolutely fantastic with LISTDS command with MEMBERS option...

Thanks all !!!
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 Populate last day of the Month in MMD... SYNCSORT 2
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
Search our Forums:

Back to Top