Sequential Stage

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
mimran
Participant
Posts: 7
Joined: Wed Nov 05, 2003 2:56 pm

Sequential Stage

Post by mimran »

I've a file consisting of records with different format.

The first record is of one format.
The following couple of records belong to one format
The last record is of another format

I would like to ouput these three different types of records in 3 different files.

Can I achieve this using sequential file stage?? If yes, then how??

What stage to use if not possible with sequential file stage??

Thanks in advance.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

If your file always has the same mixed format you can split it up using simple Unix commands.

This command will give you the first line:
head -1 filename > newfilename

This one gives you the last line:
tail -1 filename > newfilename

This one gives you the 2nd and 3rd lines:
head-3 filename | tail -2 > newfilename

You can run these three commands from a DataStage routine or from a DSExecute stage in a sequence job.
bigpoppa
Participant
Posts: 190
Joined: Fri Feb 28, 2003 11:39 am

Sequential Stage

Post by bigpoppa »

Also,

sed '1d;$d' filename >> outfilename

will put all the records in filename except the first and last into outfilename.

-BP
Post Reply