Page 1 of 1

how to reference input columns listed in schema file

Posted: Tue Nov 23, 2010 8:25 am
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,

Posted: Tue Nov 23, 2010 8:39 am
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.

Posted: Wed Nov 24, 2010 8:16 am
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,

Posted: Wed Nov 24, 2010 8:19 am
by ArndW
You need to create a default value for DOLLAR_AMT. In your schema file add "default=0" or something similar.

Posted: Wed Nov 24, 2010 8:26 am
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.

Posted: Wed Nov 24, 2010 8:54 am
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};

Posted: Sun Nov 28, 2010 2:32 am
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?

Posted: Sun Nov 28, 2010 3:51 am
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