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;
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.