View previous topic :: View next topic
|
Author |
Message |
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
'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 |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
agree with You , 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 |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
Hi enrico, you guessed right !
Its working absolutely fantastic with LISTDS command with MEMBERS option...
Thanks all !!! |
|
Back to top |
|
|
|