Page 1 of 1

Schema file default values

Posted: Mon Apr 14, 2008 9:56 am
by kavuri
Hi,
I am having a schema file. It contains 5 fields. Input files what I am having are sometimes 5 fields and sometimes only 4 fields are there.

In this case Is there any way to parse one field with a default value in the schema file.

Thanks
Kavuri

Posted: Mon Apr 14, 2008 4:21 pm
by ray.wurlod
You can provide a default value for every field.

To learn how, create a table definition using the GUI, with default value(s), then go to the Layout tab and look at its record schema. That's what you need to do in your schema file.

Posted: Mon Apr 14, 2008 9:27 pm
by JoshGeorge
Ex:
record
(
TEST_COLUMN:string[2] {default='AB'};
)

Posted: Mon Apr 21, 2008 11:16 am
by kavuri
Hi George,
My input records are coming somtimes with 4 fields and sometimes with 5 fields. So can you tell me how we can resolve this in the partial schemas.

Thanks
Kavuri

Posted: Mon Apr 21, 2008 1:12 pm
by kumar_s
It depends upon the method you use to frame the Schema file. If you have any coding mechanism which actually read the file and create the Schema File? If so handle the defaults adding up in the same.
Or be more specific up on ur question.

Posted: Mon Apr 21, 2008 4:15 pm
by kavuri
I am using partial schema, something like below.

record{ intact=details, record_delim_string='\n'}
(
Store:string[1] {delim=none};
Store_ID: string[5] {delim=none};
Day: string[10] {delim=none};
Trans_Count: string[5] {delim=none};
DOL: string[] {delim=none};
)


In the input file I wont get first field sometimes. Currently I am appending a character in the shell script and calling the datastage job. i am passing the above schema file in the sequential file stage options schema file.

I am not at all using column names in the sequential file stage. When I pass this to copy stage then in the output of copy stage I am defining my column names.

In the above schema as i am not using all 5 fields always, I want to use some default value for the first filed.

Can you suggest a way for this?

Thanks
Kavuri