LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (November 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 4 Nov 2002 16:27:37 +0100
Reply-To:     Peter Crawford <peter.crawford@DB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Crawford <peter.crawford@DB.COM>
Subject:      Re: read all members of a PDS to find SAS programs?
Comments: To: Sterling Price <Sterling.Price@WAL-MART.COM>
Content-type: text/plain; charset=iso-8859-1

Hi Sterling good luck I tried a similar search(then it was for y2k issues in code). Some code members were not complete steps, so data/ proc/run etc were not adequate indicators. I found the existence of a ';' in the first 100 lines quite a good indicator of sas code. ....... until I discovered that ';' was a common .csv delimiter in a german environment ! Fortunately, data and code were not often stored in the same pds !

Rather than a macro looping over all members, I used the infile option FILEVAR=. To read from all memebrs of a pds, I used something like the technique you propose.... except with program libraries on both os390 and winNT I needed cross- platform solutions. I adopted two.... proc pds on os390 and a data _null_ step to read the dir output on winNT. Both deliver a list of member names in a dataset. That data set is set and a filevar value constructed ........ a bit like ( where &path holds pdsname or subdir\path)

LENGTH fullfile $80 ; set one end=end_lib; ****get the membernames to search ; if "&sysscp" = "OS" THEN fullfile= COMPRESS( "&path(" || filename || ")" ); ELSE fullfile= "&path\" || filename ;

infile many filevar=fullfile end=eof truncover LENGTH=L; do until( eof ); **** read lines until end-of-member ;

There are many examples of proc source filling a dataset like that "one" above, in many places, including on-line doc as well as sas-l archives.

Let me know if you need another <g>

Regards Peter Crawford

Datum: 04/11/2002 14:40 An: SAS-L@LISTSERV.UGA.EDU

Antwort an: Sterling Price <Sterling.Price@WAL-MART.COM>

Betreff: read all members of a PDS to find SAS programs? Nachrichtentext:

Greetings,

I'm trying to find a way to read all members of a PDS in a data step, with the added wrinkle that I need to know the name of the member I'm reading while processing it. So, if I have 100 members named MEM1-MEM100 in the PDS, I'd like to read them all with one infile statement (without knowing in advance how many members there are or doing a big JCL concatenation), but if I'm on MEM25 (for example), I need to know that the name of the member I'm currently processing is MEM25. Is this do-able?

If not, I'm considering using Proc PDS to generate a list of the members, then do my processing one member at a time, inside a macro.

The context for this is that I need to go through several PDSs, each with thousands of members, and trying to identify all the SAS programs in each PDS, using the RX pattern-matching functions. I intend to look for "PROC" or "DATA" followed by any number of characters and ending in a semicolon. Granted, there will be a lot of duplicates, but then I will sort the duplicates out to find unique SAS programs that are members of these PDSs.

I'd appreciate any suggestions on how to process the PDS all at once, or a better approach for doing this if one exists.

Thanks,

Sterling Price

********************************************************************** This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately. ********************************************************************** Wal-Mart Stores, Inc. Confidential **********************************************************************

--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Back to: Top of message | Previous page | Main SAS-L page