Schema file default values

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
kavuri
Premium Member
Premium Member
Posts: 161
Joined: Mon Apr 16, 2007 2:56 pm

Schema file default values

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

Ex:
record
(
TEST_COLUMN:string[2] {default='AB'};
)
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
kavuri
Premium Member
Premium Member
Posts: 161
Joined: Mon Apr 16, 2007 2:56 pm

Post 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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
kavuri
Premium Member
Premium Member
Posts: 161
Joined: Mon Apr 16, 2007 2:56 pm

Post 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
Post Reply