BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
sas01
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

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;

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 362 views
  • 1 like
  • 2 in conversation