DATA Step, Macro, Functions and more

How to find the record length of a mainframe file using SAS?

Reply
New Contributor
Posts: 3

How to find the record length of a mainframe file using SAS?

I'm trying to access a mainfram file(Fixed format file) in SAS. Is there an option to get the record length of the file? 

Super User
Posts: 19,875

Re: How to find the record length of a mainframe file using SAS?

Posted in reply to aswinappus

If you read it in using _infile_ you should get the RECL in the log.

 

If it's a fixed format file, you'll need a standards doc though otherwise parsing it out is going to be a pain in the neck.

SAS Super FREQ
Posts: 8,868

Re: How to find the record length of a mainframe file using SAS?

If the file is catalogued, the LRECL should be available from the system catalog.

cynthia
New Contributor
Posts: 3

Re: How to find the record length of a mainframe file using SAS?

Yes, it is a fixed format file. 

Super User
Posts: 7,866

Re: How to find the record length of a mainframe file using SAS?

Posted in reply to aswinappus

Fixed format files do have a structure in the program that created them. Most often, that structure is not kept within the program, but an external include file. Get hold of that include file, and use it to write your data step. After you have accounted for all variables, add the lengths of the used formats.

This is a major part of my work, as my source data comes from DB/2 running on a virtual MF environment on Linux.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: How to find the record length of a mainframe file using SAS?

Posted in reply to KurtBremser

Thanks!, But, did you mean to use the copybook of the mainframe file?

Super User
Posts: 7,866

Re: How to find the record length of a mainframe file using SAS?

Posted in reply to aswinappus

aswinappus wrote:

Thanks!, But, did you mean to use the copybook of the mainframe file?


I don't know what you mean by copybook in this context. Our external file strcutures are kept as PL/1 include files.

The easiest way to get the metadata of mainframe files is to log on to the mainframe and use the ISPF/PDF services from TSO to display file information.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
SAS Super FREQ
Posts: 8,868

Re: How to find the record length of a mainframe file using SAS?

Posted in reply to aswinappus
HI:
If you have COBOL copybooks you might research an older routine called "COB2SAS" that could take a COBOL file definition and turn it into a SAS INPUT statement for the purpose of reading a file created with COBOL into SAS format.

cynthia
Ask a Question
Discussion stats
  • 7 replies
  • 437 views
  • 0 likes
  • 4 in conversation