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 (May 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 29 May 1998 12:57:32 -0400
Reply-To:   "Kowalczyk, Andrew" <AKowalczyk@NT.DMA.STATE.MA.US>
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   "Kowalczyk, Andrew" <AKowalczyk@NT.DMA.STATE.MA.US>
Subject:   Re: (MVS): VSAM Files on MVS
Comments:   cc: "Michael A. Raithel" <MICHAEL.RAITHEL@RAITHM49.CUSTOMS.SPRINT.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Of course another fine book on this subject is: Tuning SAS(R) Applications in the MVS Environment by Michael A. Raithel ISBN: 1-55544-278-1 <http://www.sas.com/www-bin/bleat@2223/launch/book/55231/215606307389897 2587684620/141453>

Andy Kowalczyk (no relation) > ---------- > From: Michael A. > Raithel[SMTP:MICHAEL.RAITHEL@RAITHM49.CUSTOMS.SPRINT.COM] > Sent: Friday, May 29, 1998 9:21 AM > Subject: (MVS): VSAM Files on MVS > > Myra Oltsik posted the following question: > > > >I'm extracting data from a VSAM file on MVS with SAS > >6.09E. I think the VSAM file is indexed on BARCODE. How > >can I take advantage of this? Here's some of my present > >code. Can it be improved? > > > > Myra's code example can be found beneath the Sig line, > below. > > Myra, this is definitely an interesting question! I would > take a different track than you did, by eliminating the > creation of the SAS Format and using the POLIS file as a > "key field" search file. Assuming that you have a VSAM > KSDS file, I would do the following: > > > DATA POLIS / view=polis; > INFILE POL VSAM END=TRAIL; > INPUT > @ 1059 BARCODE $12. > @; > > IF BARCODE NE 'ERROR' AND BARCODE NE ''; > <more code> > RUN; > > PROC SORT DATA=POLIS(KEEP=BARCODE) OUT=PBC NODUPKEY; > BY BARCODE; > RUN; > > > DATA TP; > set pbc; > > INFILE TX VSAM key=barcode feedback=fdbk; > INPUT > @ 1 barcode PD7. /* BAR-CODE */ @; > REC=_N_; > if fdbk = 0 then do; > INPUT > @ 8 BD PD3. /* BIRTHDATE-YYMM */ > <more code> > end; > RUN; > > > In the code, above, everything written in non-capital > letters is my suggested changes. First, I would use a data > step view for POLIS This is not required, but is something > that I almost always do, now, to materialize the data only > when it is absolutely needed. > > Secondly, I would include the KEY= and the FEEDBACK= > options on the INFILE statement. The KEY= option lets VSAM > (Access Method Services, in reality) know that the VSAM > KSDS will be read via a key variable that you/me/we supply. > In the case, above, the key variable is BARCODE. The > FEEDBACK= option designates a variable that will contain > the "condition code" for the particular VSAM action. In > this case the VSAM action is a keyed read of a VSAM KSDS. > > Thirdly, I would "SET" the PBC SAS data set before the > INFILE statement. This would allow me access to each and > every "key field" observation in the PBC SAS data set. I > would be reading a PBC observation, with its unique value > of BARCODE, and then using that value--via the KEY= option > on the INFILE statement--to read the TX VSASM file record > with the corresponding BARCODE value... if one exists. If > one exists, I will get a FDBK value of 0 (zero), and do the > other cool things that I need to do with the VSAM data. If > not, then I would do, then I would do, then I would do... > whatever... > > On an unrelated, performance note. I would want my SAS > application to "SCREAM" through the VSAM files. So, I > would probably look into manipulating the VSAM buffers. > This can be done via the BUFNI= and BUFND= options on the > INFILE statement. As, there is enough material on that > topic to fill a chapter in a book, I will not go over it > here:-) It is just a hint on a way that you can decimate > EXCP's (I/O's). I covered this material in the following > old, old, old paper: > > Buffering Those SAS VSAM Performance Headaches > Michael A. Raithel > Proceedings of the Fifteenth Annual SAS User Group > International Conference. > > Another _GREAT_ source of SAS/VSAM interaction material is: > > SAS Guide to VSAM Processing, Version 6, First Edition > > Myra, I hope that I have provided information that will be > key to your processing of VSAM KSDS information! > > > I hope that this suggestion proves helpful now, and in the > future! > > Of course, all of these opinions and insights are my own, > and do not reflect those of my organization or my > associates. > > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > Michael A. Raithel > "The man who wrote the book on performance" > E-mail: maraithel@mcimail.com > Author: Tuning SAS Applications in the MVS Environment > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ...two riders were approaching, and the wind began to > howl... > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > > ------> Myra's Original SAS Code Example <------- > > > DATA POLIS; > INFILE POL VSAM END=TRAIL; > INPUT > @ 1059 BARCODE $12. > @; > > IF BARCODE NE 'ERROR' AND BARCODE NE ''; > <more code> > RUN; > > PROC SORT DATA=POLIS(KEEP=BARCODE) OUT=PBC NODUPKEY; > BY BARCODE; > RUN; > > DATA PBC; > SET PBC (KEEP=BARCODE); > START=BARCODE; > LABEL='KEEP'; > FMTNAME='$BC'; > RUN; > > PROC FORMAT CNTLIN=PBC; > > DATA TP; > INFILE TX VSAM; > INPUT > @ 1 BC PD7. /* BAR-CODE */ @; > REC=_N_; > BARCODE = LEFT(TRIM(PUT(BC,Z12.))); > IF PUT(BARCODE,$BC.)='KEEP'; > INPUT > @ 8 BD PD3. /* BIRTHDATE-YYMM */ > <more code> > RUN; >


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