PDS Members read sequentially and update variables

Reply
Frequent Contributor
Posts: 78

PDS Members read sequentially and update variables

Could somebody please throw me an idea..I need to read the pds members sequentially and if matching string found update/create the variable to further use later in the program...I coded small test program which seems to just go one time and read only 1 member of pds though I have more than 1....

%let extfile=xxxxxx.vts.thold;                            

data _null_;                                               

rc=filename("mydir","&extfile");                           

DIRID=dopen("mydir");                                      

memcount=dnum(dirid);                                      

PUT 'THIS IS MEMCOUNT VALUE'      MEMCOUNT ;               

IF (memcount>0) then                                       

     Do i=1 to memcount ;                                   

      Memname=dread(dirid,i);                               

     Dataset="&extfile"||'('||trim(memname)||')';           

     Infile dummyf filevar=dataset                          

           filename=myinfile                                

            end=eof lrecl=80 pad;                           

      do until(eof) ;                                       

       input @'thmvdel=' thmvdel 4.;                        

      End;                                                  

      End;                                                  

run;                                                      

If i remove the Infile and read the saslog it seems the loop is going 2 times as expected (pds contain two members)....

Valued Guide
Posts: 3,208

Re: PDS Members read sequentially and update variables

Do it the easy way. Do not use the idea of a directory listing.
Use the masking *   SAS(R) 9.4 Companion for z/OS, Third Edition The filename/membername is returned when reading all members using the infile filename statement SAS(R) 9.4 Statements: Reference, Third Edition .
It almost asthonishing how many are trying to code something that is already made present.  

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 1 reply
  • 298 views
  • 0 likes
  • 2 in conversation