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

find particular member name in PDS using REXX


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

New User


Joined: 03 Aug 2011
Posts: 9
Location: Bangalore

PostPosted: Mon Dec 19, 2016 6:44 pm
Reply with quote

Hi All,

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.

Thank You!
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Dec 19, 2016 7:34 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


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

PostPosted: Mon Dec 19, 2016 7:39 pm
Reply with quote

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.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Mon Dec 19, 2016 9:57 pm
Reply with quote

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.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Mon Dec 19, 2016 10:10 pm
Reply with quote

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.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Thu Dec 29, 2016 11:59 pm
Reply with quote

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
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Fri Dec 30, 2016 2:18 am
Reply with quote

Sorry for misinformation:
REXXTOOLS by Open Software Technologies
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 121
Location: canada

PostPosted: Thu Jan 05, 2017 9:46 pm
Reply with quote

You can use LISTDS command with MEMBERS parameter

Code:

/* 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
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Thu Jan 05, 2017 10:17 pm
Reply with quote

Short working sample:
Code:

/* rexx */                                                     
 Address TSO                                                   
 sds  = 'a.lib.data'                                           
 mpfx='VSAM'                                                   
 mpfxl=length(mpfx)                                             
                                                               
 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                                                                                             
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2010
Location: USA

PostPosted: Fri Jan 06, 2017 9:02 pm
Reply with quote

Just FYI

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.

Example:
Code:
listds 'sys1.linklib' members 

SYS1.LINKLIB                   
--RECFM-LRECL-BLKSIZE-DSORG   
  U     **    32760   PO       
--VOLUMES--                   
  X2C1T1                       
--MEMBERS--                   
  ADFIDF00                     
  ADFMCOPY  ALIAS(SMC,SMCOPY) 
  ADFMDFLT                     
  ADFMDF0A                     
  ADFMDF01  ALIAS(ADFGLUET)   
  ADFMDF03                     
  ADFMDOLD                     
  ADFMFIND  ALIAS(SMF,SMFIND) 
  ADFMPUT  ALIAS(SMP,SMPUT)   
  ADRCIPH                     
. . . . . . . . . . . . . . . . . . .
  AHLWTASK                                                       
  AIRAMBGN                                                       
  AIRAMPVT  ALIAS(AIRA1INI,AIRH1CHK,AIRH1DCT,AIRP1TSK,AIRS1STK,   
           AIRS2STK)                                             
  AIRAMRES                                                       
. . . . . . . . . . . . . . . . . . .
  ANTCVXPR  ALIAS(ANTCVX00,ANTCVX01,ANTCVX02,ANTCVX03,ANTCVX04,           
           ANTCVX05,ANTCVX06,ANTCVX07,ANTCVX08,ANTCVX09,ANTCVX10,ANTCVX11,
           ANTCVX13,ANTCVX15,ANTCVX16,ANTCVX17,ANTCVX18,ANTCVX19,ANTCVX20,
           ANTCVX21,ANTCVX22,ANTCVX23,ANTCVX24,ANTCVX25,ANTCVX26,ANTCVX27,
           ANTCVX28,ANTCVX30,ANTCVX31,ANTCVX32,ANTCVX33,ANTCVX34,ANTCVX35,
           ANTCVX36,ANTCVX37,ANTCVX38,ANTCVX39,ANTCVX40,ANTCVX41,ANTCVX42,
           ANTCVX43,ANTCVX44,ANTCVX45,ANTCVX48,ANTCVX49,ANTCVX50,ANTCVX51,
           ANTCVX52,ANTS4902,ANTS4903,ANTS4904,ANTS4905,ANTS4906,ANTS4907,
           ANTS4908,ANTS4909,ANTS4910,ANTS4948,ANTS4950,ANTS4951,ANTS4952,
           ANTUSAF)                                                       
  ANTKDBUG                                                                 
  ANTKHSX                                                                 
  ANTKING                                                                 
  ANTKPDO                                                                 
  ANTMAIN                                                                 
  ANTMONR1                                                                 
  ANTSDMLK  ALIAS(ANTSDMLP,ANTUSUBT,ANTXPRSM)                             
  ANTSDMLL  ALIAS(ANTUFABN,ANTUFFND,ANTUFOEX,ANTUFSTW)                     
  ANTSTRT  ALIAS(ANTXAINI)                                                 
  ANTURQST  ALIAS(ANTCNVRT)                                               
  ANTUSCAN  ALIAS(ANTUCMPR,ANTUDRVR)                                       
  ANTUXDVC                                                                 
  ANTUXFQA                                                                 
. . . . . . . . . . . . . . . . . .
 etc. etc. etc .
 


If somebody is interested I have in my archives the old REXX function code to handle any combination of member names/aliases.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Sat Jan 07, 2017 1:27 am
Reply with quote

I like programs like the PDS86 found on cbttape.org file 182, because with that you can do copy including aliasses.
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 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
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top