Dynamic File Layouts

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
samit_9999
Participant
Posts: 20
Joined: Thu Oct 06, 2005 12:23 pm

Dynamic File Layouts

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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...
-craig

"You can never have too many knives" -- Logan Nine Fingers
samit_9999
Participant
Posts: 20
Joined: Thu Oct 06, 2005 12:23 pm

Post by samit_9999 »

how about if it is a normal file and not a fixed width file
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply