Extract from sequential file

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
murali
Participant
Posts: 54
Joined: Mon Sep 12, 2005 11:38 pm

Extract from sequential file

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Extract from sequential file

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply