06-08-2016 03:17 AM
Hi SAS Expert Team,
I have a query reading the large VB file in Mainframes. File specs are below.
File length = 11504
File Type = VB (Variable block)
Contains Records with variable length. Example : If record 1 have the length of 765, then the rest of the characters in the observation 1 are null values. At position, 766 there will be CRLF that will specify the end of the observation.
All the obseravations start with the date in the format 'YYYYMMDD' format.
Many instances, thre is a need to filter data on basis of
> DATE in the first 8 characters and
> customer-id placed randomly in the observation
> Invoice Number placed at the fixed position of 65.
How should I write a DATA step to read a Mainframe VB file and create sub-file based on the criteria.
06-08-2016 03:40 AM
Do you run SAS on the mainframe or another platform?
If another platform, do you have direct FTP access to the MF or do you receive the file via another path?
06-08-2016 03:46 AM
06-08-2016 03:58 AM
06-08-2016 04:16 AM
06-08-2016 04:37 AM
The first thing I'd try would be the RECFM=VB option in the infile statement. For VB files, z/OS maintains a separate 4-byte RDW (record descriptor word) that holds the current record length in its first two bytes. This eliminates the need for record separators.
Omitting the RECFM= options forces SAS to use any CRLF or similar combination (LF only, eg) as a record separator.
With RECVM=VB, you should not have line skips when a CRLF is encountered in the data.
06-08-2016 05:51 AM
06-08-2016 06:50 AM
data fileout; infile filein1 recfm=vb lrecl=11504 truncover; input var1 $1. date_var $8. rest_string $11493. ; run;
If that doesn't fix your CRLF problem, you need to have those CRLFs stripped before you read into SAS.
Alternatively you could try to read with recfm=n (this reads the input as a non-formatted stream), read chunks of, say, 100 bytes into a large buffer until you find the line-delimiting '**' in your buffer, and work data out of the buffer. Then start reading again until you encounter the next '**' or EOF.