I am new to rexx, Could you please let me know how can I find the member name that starts with AAA( example ) in the given PDS using REXX. Thanks much in Advance.
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
And reading all about the all the LM services before you start coding. And you might as well read the Dialogue Manager guide as well.
Also, as you are new to rexx why post in the expert's forum and not the beginner's forum? Even I ask my questions in the beginner's forum when it is not a subject that I am competent in.
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
Akatsukami wrote:
Searching a PDS directory in Rexx is tricky and quite possibly above your pay grade. You will be better off using the ISPF LMMLIST service.
As Akatsukami says, it is possible to read and parse a PDS directory in Rexx, but it is moderately difficult. The LMxxx services are much easier, but they are connected to ISPF, which means preparing the environment for ISPF must be done. <Is this true??>
A method that is somewhat simpler and usable even by a Rexx beginner is to output trap the output from the TSO LISTDS dataset MEMBERS command. -
Code:
XXXXXX.LMEM.LOAD
--RECFM-LRECL-BLKSIZE-DSORG
U ** 32760 PO
--VOLUMES--
XXXXXX
--MEMBERS--
LMEM
TEMPNAME
Your Rexx EXEC must then examine the member list. Click here to go to the discussion of OUTTRAP in a somewhat back level Rexx manual.
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
steve-myers wrote:
The LMxxx services are much easier, but they are connected to ISPF, which means preparing the environment for ISPF must be done. <Is this true??>
Yes; the ISPF libraries must be allocated and the script started via the ISPSTART command. If one is running ISPF in the foreground, of course this is all automatic, but in the background the JCL must follow the examples given on these fora.
If REXXTOOLS by Compuware are available in your environment then you could use some functions from there, like LISTM:
Code:
Parse Value LISTM("'USER01.LIBRARY'") With RC memcnt mlist
If RC = 0 Then
Do i=1 To memcnt
Parse Var mlist mem mlist
Say mem
End
Else Do
Parse Var memcnt reason dsn message
Say 'LISTM error:' message
End
/* REXX - */
dsn = your pds
APP = OUTTRAP( "F.",'*')
"LISTDS '"||dsn||"' MEMBERS"
APP = OUTTRAP( "OFF")
DO I = 1 TO F.0
IF substr(word(F.I,1),1,4) = 'AAAA' THEN say F.I
END
where dsn your PDS name, F - is array with LISTDS results
zz=outtrap('smbr.')
"listds '"sds"' members"
zz=outtrap('off')
do n=7 to smbr.0
say 'Source member:' smbr.n
if Abbrev(strip(smbr.n),mpfx,mpfxl) then say 'match:' smbr.n
end
In some cases there is a trap with using LISTDS command to analyze PDS member list. This doesn't happen too often, but if by a chance the library contains aliases besides of regular member names the output is a bit messy.