IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

how to list out all the members of a particular PDS by using


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

New User


Joined: 30 Aug 2006
Posts: 4

PostPosted: Thu Sep 14, 2006 7:22 pm
Reply with quote

Hi All,

I want to write all the members of a particular PDS into another PS.
is it possible in REXX since i am new to this language.
if so can i get the pseudo code for this.
it can be in REXX or ISPF or clist....

Thanks In Advance,
Christpoher J
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Sep 14, 2006 7:38 pm
Reply with quote

Go into option 3.1 (Library).

Next to Data Set Name enter your PDS with single quotes.

Place an "X" (Print Index Listing) next to Option and press enter to print an index listing.

The system will say: INDEX PRINTED

Enter 'HELP' next to Option and press enter.

The system will show the dataset it placed your index in.

Enter 'LIST' next to Option and press enter.

Select option 3.- Keep existing data set and continue with new data set.

Go back into option 3.4 and DISPLAY your USERID next to dsname level.

Browse or edit your USERID.SPF?.LIST dataset to see the PDS members
Back to top
View user's profile Send private message
Kevin

Active User


Joined: 25 Aug 2005
Posts: 234

PostPosted: Thu Sep 14, 2006 9:20 pm
Reply with quote

There's no REXX function that deals with PDS's.

On top of the suggestion from cpuhawg, there's also the TSO LISTDS command and the ISPF LMMLIST service. You can also, as in other languages, read the PDS directory block:
Code:

/* REXX */                                                           
"ALLOC DD(pds) DA('mypds') SHR REU RECFM(F) DSORG(PS) LRECL(256) BLKSIZE(256)"
"EXECIO * DISKR pds (STEM dir. FINIS"                                 
Do blk = 1 To dir.0                                                   
  usedbytes = C2D(Substr(dir.blk,1,2))                               
  index = 3 /* skip past used bytes */                               
  Do While index < usedbytes                                         
    If Substr(dir.blk,index,8) = 'FFFFFFFFFFFFFFFF'x Then Leave       
    pds2name = Substr(dir.blk,index,8) /* member name */             
    Say pds2name                                                     
    index = index + 11 /* skip past name and ttr */                   
    pds2indc = Substr(dir.blk,index,1)                               
    len = Bitand(pds2indc,'1F'x) /* isolate user data length */       
    userdata = C2D(len) * 2 /* halfwords to bytes */                 
    index = index + userdata + 1 /* skip past user data */           
  End                                                                 
End                                                                   
"FREE DD(pds)"                                                       
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Thu Sep 14, 2006 9:31 pm
Reply with quote

Try this:
Code:
/**/
X = OUTTRAP("MEMLST.")
"LISTDS 'mypds' MEMBERS"
X = OUTTRAP("OFF")
DO I = 1 TO MEMLST.0
  SAY MEMLST.I
END

In your rexx you will have to ignore everything up to the "--MEMBERS--" line
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Thu Sep 14, 2006 9:56 pm
Reply with quote

(Sorry, just reread the question). The full code could be:
Code:
/* REXX */                                 
mypds = 'z1i.spf.clist'                   
outfile = 'z1i.temp.work1'                 
                                           
X = OUTTRAP("MEMLST.")                     
"LISTDS '"mypds"' MEMBERS"                 
X = OUTTRAP("OFF")                         
                                           
/* bypass until MEMBERS found */           
Do I=1                                     
   If MEMLST.I = "--MEMBERS--" Then Leave 
End                                       
                                           
/* start real process here */             
"ALLOC FI(FOUT) DA('"outfile"') SHR"         /* allocate output file */
Do I = I+1 TO MEMLST.0                     
   inpname = mypds"("strip(MEMLST.I)")"      /* make input name */
   "ALLOC FI(FINP) DA('"inpname"') SHR"      /* allocate input member */
   "EXECIO * DISKR FINP (FINIS STEM lines."  /* read input */
   "EXECIO * DISKW FOUT (STEM lines."        /* append to output */
   "FREE FI(FINP)"                           /* release input member */
End                                       
"FREE FI(FOUT)"
Back to top
View user's profile Send private message
jchristdoss

New User


Joined: 30 Aug 2006
Posts: 4

PostPosted: Fri Sep 15, 2006 6:53 pm
Reply with quote

Hi All

Thanks for all your quick replies..
now it is working..

Regards,
Christopher J
Back to top
View user's profile Send private message
ezhavendhan

New User


Joined: 27 Mar 2013
Posts: 11
Location: India

PostPosted: Tue Jun 11, 2013 6:15 pm
Reply with quote

Marso,

Your code works fine with the input as PS. I want to know the possibility to write to another PDS member. Kindly enlight on this.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1566
Location: Andromeda Galaxy

PostPosted: Tue Jun 11, 2013 6:20 pm
Reply with quote

Never reactivate the old thread and for queries please start a new topic and explain better with what is the requirement , what is expected and what is being done so far ..

So it would help others and you to narrow down on the solution
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 11, 2013 6:29 pm
Reply with quote

ezhavendhan wrote:
Marso,

Your code works fine with the input as PS. I want to know the possibility to write to another PDS member. Kindly enlight on this.


the INPUT is a PDS and the OUTPUT is a PS.

all you would have to do is change the outfile value and the modify the FOUT ALLOC command.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> CLIST & REXX
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts List of Active Jobs in CTRL-M JCL & VSAM 1
No new posts Members search in PDS JCL & VSAM 9
No new posts Fetch the Dataset names from inside m... TSO/ISPF 18
No new posts Need help in REXX code to list the af... CLIST & REXX 3
No new posts Extracting a list of ALL DSN's on an ... IBM Tools 14

Back to Top