Hello,
We are reading in a rawdata EBCDIC file from First Data (containing senstive information, so I can unfortunately not provide a sample of the data), that we are reading into SAS and converting to ASCII. We've done about 6 of these types of files without problems. This specific data file is giving us some problems.
The issue is that the file FD provides us contains two sets of variables and lengths...basically the file contains chapter1 and chapter2 data.
Chapter1 is a fixed record length file of 1568 with 159 different variables/columns.
Chapter2 is also fixed record length of 188, with only 28 variables.
And again, the datafile contains records of either chapter, and in a non-sorted way. So record 1 could be either ch1 or ch2. The file is also different from day to day.
I can segregate out the second chapter into a seperate datafile easily, because we know there is a unique identifier field and it is only a length of 188 characters. Here's part of the code for ch2 segregation:
libname cd 'D:\FileConversion\CD061';
filename readin "D:\FileConversion\CD061\CD061.EBCDIC.DAT";
data cd.temp3 (compress=yes);
infile readin recfm=f lrecl = 188 firstobs=1 ;
input
@1 ACCT_TOT_KEY_SYSTEM $ebcdic4.0
@5 ACCT_TOT_KEY_PREFIX $ebcdic7.0
...
;
end;
if L_TPI_B eq 'T';
run;
This creates a dataset with only data from ch2. The file contains 1149 records total, and we kept 475 from ch2 according to the log:
NOTE: The infile READIN is:
File Name=D:\FileConversion\CD061\CD061.EBCDIC.DAT,
RECFM=F,LRECL=188
NOTE: 1149 records were read from the infile READIN.
NOTE: The data set WORK.A has 475 observations and 28 variables.
So the remaining records belong to chapter1.
Up until this point it works great.
Now I'm trying to get the remaining chapter 1 (674 total for this specific file) records into another dataset. I'm getting stuck on how to seperate these. Here's the current code:
data cd.temp4 (compress=yes);
infile readin recfm=f lrecl=1568 missover firstobs=1 ;
input
@12 MULT_FLG $ebcdic1.0;
if MULT_FLG ne 'T' then do;
input
@1 ACCT_JOUR_KEY_SYSTEM $ebcdic4.0
@5 ACCT_JOUR_KEY_PREFIX $ebcdic7.0
..
;
end;
if MULT_FLG ne 'T';
run;
With the lrecl set to 1568, the dataset looks garbled. If I change the lrecl to 188 again, ch1 reads in fine, but of course, only the first 188 characters of the the file, which is approx 28 ch1 variables (so over 100 variables are missing).
I think my question is this, how can I seperate out the ch2 data from the file, and only keep ch1 with all of its 150+ variables?
I've tried various "infile" options, including flowover, missover, truncover.
I've tried different lrecl sizes, but only 188 makes the ch1 data appear correct (but this only lists ~20 variables out of the 150+ total variables for chapter 1).
Hope someone can shed some light on this issue. I've contacted SAS directly, but haven't yet been able to get a solution.