LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Mar 2002 09:18:42 -0800
Reply-To:     "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject:      Re: How to read previous lines based upon string in current line.
Content-Type: text/plain

Create two retained variables (PREV1 and PREV2) suitable for holding a line each. Just before you iterate the loop, set PREV1 to PREV2 and set PREV2 to the current line. In each iteration, the two previous lines will always be available if you decide you need them.

Barry Schwarz OS/390 Systems Programmer Phone: 253-773-4221 Fax: 253-773-1257 Mail stop: 80-JE e-mail: barry.a.schwarz@boeing.com

> ---------- > From: Carriere, Ron[SMTP:rcarriere@MEDNET.UCLA.EDU] > Reply To: Carriere, Ron > Sent: Tuesday, March 05, 2002 11:23 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: How to read previous lines based upon string in current > line. > > I have dataset that consists of 40K+ lines of MVS JCL. I am attempting to > output a list of datasets cataloged by that JCL. Pseudo code for the task > would be > > Read a line; > > IF a line contains the string "CATLG" then do; > if line contains "dsn=' then > output the line; > else do; > read and then output the two previous and then the > current line; > end; > end; > > The "else do" part is required because the dataset name is sometimes on > one of the two previous lines. That is part I can't accomplish without > sorting and resorting the dataset, but there must be a better way using > line pointer controls, no? > > Ron Carriere > UCLA Medical Center >


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