Page 1 of 1

Extract from sequential file

Posted: Tue May 16, 2006 4:12 am
by murali
Hi All,
We need to extract data from sequential file which has 3(kinds of data)
set of records
the format of the source file is
1)HEADER
2)RECORDS
3)TRAILER
is there any method to seperate these three
sets of
records or is there any method to count the number rows in a sequential file.

Posted: Tue May 16, 2006 6:47 am
by DSguru2B
You have several ways approaching this. Tell me this,
is your header the first row(line) and your trailer the last row(line) in the file?

Re: Extract from sequential file

Posted: Tue May 16, 2006 8:19 am
by gateleys
Is the structure of your header and trailer different from the records? If so, then that could be used to separate them from the records. Regarding counting the records, a simple way would be to append a new column to the output (via a transformer) and use @INROWNUM as its derivation. If the first record is always the header and the last record, the trailer, then you can use a second transformer to split the header and trailer from the records, based on the row number.

gateleys

Posted: Tue May 16, 2006 2:50 pm
by ray.wurlod
Read the file as a single column, or perhaps two if the record type designator is at the beginning of each line. Use the value of the record type designator to constrain three outputs from a Transformer stage (header, detail, trailer). Parse the single column of data into appropriate fields on these outputs.