| Date: | Fri, 16 Nov 2001 15:29:08 -0500 |
| Reply-To: | Larry Bertolini <bertolini.1@OSU.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Larry Bertolini <bertolini.1@OSU.EDU> |
| Organization: | Ohio State University |
| Subject: | Second cousin, once removed, of Speed of SAS vs. COBOL vs. C++ |
| Content-Type: | text/plain; charset=us-ascii |
Can SAS "skip" directly to a desired record?
On OS/390, I'd give a qualified "yes", if you are processing
a file with RECFM=FBS. (the "S" indicating
"Standard", i.e., no truncated blocks; in this context,
"S" does *not* mean "Spanned")
Using SAS 8.1 on OS/390 2.9, on an HDS Pilot 27
(equivalent to an IBM 9672 R25)...
Consider the following program, in which we
attempt to skip the first 100,000 records.
Each record is 175 bytes.
There are two pairs of INFILE/INPUT statements:
* pair 1 uses RECFM=N, to access the file as
a binary stream
* pair 2 uses FIRSTOBS
(I commented out one pair for each run.)
//FOODOG DD DSN=DBAT.D1480301.ADDRESSB,DISP=SHR
//SYSIN DD *
DATA _NULL_;
/* pair 1 */
INFILE FOODOG RECFM=N ;
INPUT @17500001 FOODOG $CHAR175.;
/* pair 2 */
*INFILE FOODOG FIRSTOBS=100001;
*INPUT @1 FOODOG $CHAR175.;
PUT '----+----0';
PUT _INFILE_;
STOP;
RUN;
INFILE/INPUT method: #records skipped CPU time of SAS step
-------------------- ---------------- --------------------
RECFM=N; INPUT @1750001 10,000 0.22 sec
FIRSTOBS=10001 10,000 0.25 sec
RECFM=N; INPUT @17500001 100,000 0.22 sec
FIRSTOBS=100001 100,000 0.42 sec
Based on the fact that the "RECFM=N" program takes the same
amount of CPU to skip 10,000 and 100,000 records, I'm
tempted to infer that SAS is going directly to the desired
record, and not reading/discarding prior records. (I admit,
I haven't checked SMF data to confirm that.)
The downside is that "RECFM=N" implies UNBUFFERED (no read ahead)
processing, so it's not necessarily a good solution to Fred
Gehm's appliction. [Of course, YMMV, based on LRECL, BLKSIZE,
and the "smarts" of your disk subsystem, which may be capable of
recognizing that your application is doing sequential access,
and might start prefetching data into cache.] But I just
wanted to point that it appears that SAS can go directly to
a desired record.
|