Joined: 30 Nov 2013 Posts: 586 Location: The Universe
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. -
U ** 32760 PO
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: 1782 Location: Bloomington, IL
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:
Parse Value LISTM("'USER01.LIBRARY'") With RC memcnt mlist
If RC = 0 Then
Do i=1 To memcnt
Parse Var mlist mem mlist
Parse Var memcnt reason dsn message
Say 'LISTM error:' message
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.