Page 1 of 1

Dynamic File Layouts

Posted: Thu Jul 05, 2007 1:15 pm
by samit_9999
hi,

I am using datastage to create sequential files.This is a fixed width file with 8 columns as follows
EmpNo,FrstName,LastName,SSN,DeptNo,PhoneNo,Address1,Address2

This is a standard job that i use a number of times.Most of the times the layout remains the same, in certain cases i have to change the field positions
For example in below example field positions Phoneno,Deptno,SSN have changed from the standard layout
EmpNo,FrstName,LastName,PhoneNo,DeptNo,SSN,Address1,Address2
It can also be as follows
EmpNo,PhoneNo,FrstName,LastName,DeptNo,SSN,Address1,Address2

How do i handle such scenarios?

Please help

Thanks much in advance.

Sam

Posted: Thu Jul 05, 2007 1:38 pm
by chulett
For a fixed width file, you'll need to use two different jobs. If it was just a 'normal' file, there would be some games you could play...

Posted: Thu Jul 05, 2007 3:25 pm
by samit_9999
how about if it is a normal file and not a fixed width file

Posted: Thu Jul 05, 2007 3:59 pm
by chulett
Pass in a job parameter that controls the layout and dynamically re-arrange what field goes where based on it. Should be fairly simple if you don't need 'Columns headings' as the first record.

If so then you'll need to figure a way to 'manually' write it out as your first record. Either that or keep the various 'heading' records in separate files and concatenate the appropriate one into the output... before job perhaps.

Posted: Fri Jul 06, 2007 7:31 pm
by DSguru2B
If the column names are present in the file then you can read the column names and do a check on each column name and re-arrange it as you please.