a. You don't need nor want to output to a SAS dataset, if you just want to
count things in the infile. Each OUTPUT takes CPU time and disk space;
instead use DATA _NULL_, SUM statements to accumulate, and a PUT the
sum at the END= of the INFILE:
DATA _NULL_;
INFILE test LENGTH=LENDATA END=END;
INPUT ;
DATA+LENDATA;
DATARDW+(LENDATA+4);
IF END THEN
PUT ' Data-only BYTES in file is ' DATA= /
' Data and RDW bytes ' DATARDW=;
b. If the record format is F or FB, then the DATA= size is the total
file size.
c. However, for V, VB, or VBS files, the LENGTH=LENDATA returns only the
length of the data in the record; it does not include the four bytes of
the RDW for each record. (The LRECL is LENDATA+4).
Variable DATARDW will have the sum of bytes in the DATA+RDW, i.e., it is
the sum of all LRECLS.
d. However, DATARDW will still be missing the space taken by the 4-byte BDW,
the Block Descriptor words, in the V, VB, or VBS file, and there's no way
inside this SAS INFILE that would let you know how many blocks there were
in the original file.
But that's only because the INFILE in the examples used the RECFM of the
dataset. If instead, you tell SAS to treat the INFILE as RECFM=U, each
INPUT will read a block, rather than a record, and the LEN=LENBLOCK will
be the true BDW value of that block, so the sum in BDW= that is PUT at
the END= will be the true bytes in all records in the file.
DATA _NULL_;
INFILE test LENGTH=LEN END=END RECFM=U BLKSIZE=32760;
INPUT;
BDW+LENBLOCK;
IF END THEN PUT 'Total bytes in all blocks ' BDW=;
Barry Merrill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html