Schema File usage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Schema File usage

Post by dodda »

Hello

I have a requirement where i need to read the first record of the input File and parse each and every field and need to map to the target.target being database.The file is semicoln demilited and and every field is enclosed in quotes. This job we are planning to make as common job so even other datastage jobs can use this as a first job.
the problem is our first record can have variable no of fields
since this is a common job we are going to recieve files with different layouts for the first record in the input file.

i.e File1 can have 6 fields in the input file
File2 can have 9 fields in the input file

just wondering how to make this job as common even if the file layout vhanges for the first record of the input file.

I have tried by creating a schema file and enabling runtime col propagation. but since the no of fields are dynamic (just wondering how to create a schema file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need a separate (or at least a suitable) schema file for each source data file. The schema file name and the data file name can both be job parameters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

hello ray

thanks for the reply. but how can i make the job common. if i use file 1 and corresponding schema file then i need to map 6 fields to the target and if i use file 2 and the corresponding schema file then i need to map 9 fields.

can this be achieved. i tried this option but didnt work.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Be more specific about what you meant by "didn't work". What came through? Was RCP enabled throughout the whole job?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dodda
Premium Member
Premium Member
Posts: 244
Joined: Tue May 29, 2007 11:31 am

Post by dodda »

yes it was enabled through out the job.

i used the file1 and corresponding schema file in the seqentual file stage.

and in the transfomer on the target side i created 6 output columns which have same col names as in the schema file abd when i run the job it works fine.

but when i use the same file 1 and corresponding schema file in the seq file stage and when i defined 9 output cols on the target side of transformer it throws an error saying col7 is missing.

since i wanted to make this common job i was wondering how to achiveve dynamic mapping based on the schema file.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What if you define no columns on the output side of the Transformer stage?
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