Is there a way to get the number of records in a z/os sequential mainframe flat file without having to read, INPUT, through all the records in the file?
For Example:
If I have a sequential file named 'ABC.MYNAME.DAY01', how can I get the number of records in this file saved to a SAS variable named COUNT without having to INPUT all the records in the sequential file.
I don't think MVS stores a record count for sequential files. You might be able to estimate if you knew the filesize and record length.
You should be able to count by reading the file, you don't have to actual use any of the information you read however.
data _null_;
if eof then call symputx('numrecs',_n_-1);
infile 'my.main.frame.file' end=eof;
input;
run;
I don't think MVS stores a record count for sequential files. You might be able to estimate if you knew the filesize and record length.
You should be able to count by reading the file, you don't have to actual use any of the information you read however.
data _null_;
if eof then call symputx('numrecs',_n_-1);
infile 'my.main.frame.file' end=eof;
input;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.