Varchar to decimal transformation in generic RCP job

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
udayanguha
Premium Member
Premium Member
Posts: 37
Joined: Wed Oct 29, 2014 10:48 pm
Location: Ohio

Varchar to decimal transformation in generic RCP job

Post by udayanguha »

Hi,
I have a generic job which is loading data from sequential file to a database.
Sequential_File --> Copy stage --> DB2 connector stage.
I have some decimal fields in the sequential file which are blank and I when I try reading the file (through schema file), it gives me the following error;
Field has import error and no default value.
I read at several forums that I need to read blank decimal fields as Varchar and then convert them into decimal fields during transformation.
Now my doubt is can I handle such string to decimal conversion in a generic job which is using RCP since I am not mentioning any columns in the stage metadata.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could try using a Modify stage. Every specification in a Modify stage can be a job parameter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
udayanguha
Premium Member
Premium Member
Posts: 37
Joined: Wed Oct 29, 2014 10:48 pm
Location: Ohio

Post by udayanguha »

Hi Ray,
Since I am using RCP, I don't even know any of the field names. In that case, how can I use the modify stage to handle any decimal field? Would be really helpful if you can elaborate a bit.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Doesn't your schema file contain the column names? The name of the column could be passed to the job as a parameter, and then that string is used in a modify stage to create an appropriate column.
udayanguha
Premium Member
Premium Member
Posts: 37
Joined: Wed Oct 29, 2014 10:48 pm
Location: Ohio

Post by udayanguha »

Hi Andrew,
I have multiple files and there are too many fields like field1 in file1, field2 in file 2 so there's no common fieldname in the files. Every file has its own fields and its own field names.
In this case would I be able to handle the transformation through a generic job?
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Create yourself a little utility using your favorite tool ksh, perl, server job, parallel job, BASIC routine, or whatever.

Your utility will read through the schema file looking for decimal columns and generate all of modify specifications that you need.

Then just pass all of the modify specifications into your generic job as a job parameter.

Mike
cdp
Premium Member
Premium Member
Posts: 113
Joined: Tue Dec 15, 2009 9:28 pm
Location: New Zealand

Post by cdp »

What if you just try adding a Null field value equal to '' in your Sequential file Stage ? (Format tab>Field defaults>Null Field value)
udayanguha
Premium Member
Premium Member
Posts: 37
Joined: Wed Oct 29, 2014 10:48 pm
Location: Ohio

Post by udayanguha »

I tried adding a NULL value in the schema file itself and that worked. Thanks all.
Post Reply