Page 1 of 1

Reading rows using schema file

Posted: Thu May 12, 2005 5:05 am
by NewPXUser
Hi All,

I am trying to read row from a sequential file using column defn from a schema file.

The schema file has

Code: Select all

record (
  account_number: decimal[4, 0];
  phone_nbr: decimal[1, 0];
)
and the sequential file has

Code: Select all

1111,1
2222,2
3333,3
4444,4
Questions:
1.) I am not able to view data unless and otherwise I provide the column defn.s in the column tab. Why?
2.) When I run this job (without col defn), it returns the warning message for each row, which is some like below
Sequential_File_0,0: Field "account_number" has import error and no default value; data: {1 1 1 1 , 1}, at offset: 0
Why does this appear as the data matches the column requirements?
3.) How to make this job work? :(

Thanks in advance.

Posted: Thu May 12, 2005 8:09 am
by richdhan
Hi NewPXUser,

If you want to use a schema file for a sequential file then you create a dummy job which loads a fileset with the following column configuration. Open the fileset and get the schema structure. Use the schema structure for the sequential file. Hope this resolves all your issues.

Keep us posted.

Rich

Posted: Thu May 12, 2005 4:26 pm
by T42
DataStage is dumb. Dumb. Dumb dumb dumb.

It does not read minds.

It does not know what the intent of something is.

It does not know what is right, what is wrong, where things are, and where things should be.

Keep that in mind, and whenever you tell DataStage to do something, you have to tell it everything that it needs to know, including what the column formats are.

DataStage heavily depends on metadata to get things done. It is not a dynamic language in that sense.

I hope this answers your question.

Posted: Fri May 13, 2005 8:00 am
by NewPXUser
T42,

With no disrespect, all I asked for is someone to point out what the mistake with the schema file defn that gives raise to the warning during runtime. i.e. is the data content not a decimal or must some special parameters need to be set to read the specified format etc.

This is why I mentioned the sentence
'First time schema usage. So need help'
in the additional info box.

I have used DataStage Server Edition and am trying to understand the usage of schemas as we have requirements for partial schemas in our project.

So if anyone can guide me through this initial stage, it will be very helpful.

Posted: Mon May 16, 2005 11:13 am
by richdhan
Hi NewPXUser,

Did you try the solution I had provided.

Rich

Posted: Tue May 17, 2005 1:01 am
by roy
Hi,
If my mempory serves me ....
Not 100% sure of this so give it a try.
When reading from an ascii sequential file using C/C++ which is the parallel jobs always read as char/varchar and such types even if you deal with numbers.
later "Modify" the column types to suite your needs.

to verify this try defining your columns as char/varchar types and see if the import error persists.

please post your findings :).

IHTH,