how to reference input columns listed in schema file

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
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

how to reference input columns listed in schema file

Post by Aggie99 »

I have a job that uses a schema file in the sequential file stage. It is all working in terms of loading the file correctly into the database.

job flow:
Sequential File -> Transformer -> Load database

schema file has a field called dollar_cd.

I need to use the dollar_cd field inside the transformer stage. But I don't know how to reference the field name in the transformer? Anyone knows how it works in terms of referencing any of the fields in the schema file?

thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Just declare "dollar_cd" in the input link of the transform stage with the appropriate data type length and then you can work with that column, assuming that it is being delivered via RCP. You can check this by turning on OSH_PRINT_SCHEMAS to see which columns are being pushed through each link.
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

Post by Aggie99 »

thanks,

RCP is turned on.

yes, I can use the dollar_cd field in the transformer now. But when I try to use another column from the schema file, I have an error saying "Field DOLLAR_AMT has import error and no default value".

DOLLAR_AMT field is decimal[38,10]

What I did then, was going to Sequential File -> Format tab -> Field defaults -> add Null field value=0.

But the job still has the same error.

what can I do to resolve it.

thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

You need to create a default value for DOLLAR_AMT. In your schema file add "default=0" or something similar.
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

Post by Aggie99 »

i can't find the syntax to add default value in schema file. can you provide me an example.

how would the line looks like?

thanks again.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I gave you the syntax, you need to add the "default=0" string, e.g.

Code: Select all

URVA:decimal[1,0] {, default=0,zoned,unsigned};
dsa
Participant
Posts: 37
Joined: Sun Oct 10, 2010 7:52 am

Post by dsa »

ArndW wrote:Just declare "dollar_cd" in the input link of the transform stage with the appropriate data type length and then you can work with that column, assuming that it is being delivered via RCP. You can che ...


Hi Arndw,

Do we really have to declare it again as we already have RCP enabled, so it's definition should automatically pass to transformer stage?
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

I think what ArndW meant by 'declare' is use the column name and NOT to create a variable of the same name as a 'column name'

regards
sreeni
Post Reply