Fixed Width Column

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kate_gkl
Participant
Posts: 22
Joined: Mon Jul 19, 2004 2:33 am
Location: Kuala Lumpur, Malaysia

Fixed Width Column

Post by kate_gkl »

Hi.

I still having problem with importing fixed width column data into DataStage.

First of all, I would like to know if we are using fixed width when importing metadata, the column name must be the same as the width that we specified?

Secondly, how about the data? All of them must be in the width that have been specified?

Thanks all for reading and giving me guidance on this issue. Cheers~~
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

The column name doesn't matter whether it is same or not. But give a meaningful name so that it is easy when you are doing your mapping. How fixed width works is by the position. You have to give the correct length otherwise it will end up in some other column. Even if you miss one position your mapping will become wrong.

Hope this helps

Thanks
Siva
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Fixed Width Column

Post by chulett »

kate_gkl wrote:First of all, I would like to know if we are using fixed width when importing metadata, the column name must be the same as the width that we specified?
Assuming you are talking about the header record in the file, then yes - or at least no longer than. However, fixed width files generally do not have a header record.
Secondly, how about the data? All of them must be in the width that have been specified?
Yes. Each field must start in the same position in each record. Since the program reading the file cannot tell where fields start and stop based on delimiters, it must rely on the metadata to know how many bytes to read for each column and record.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kate_gkl
Participant
Posts: 22
Joined: Mon Jul 19, 2004 2:33 am
Location: Kuala Lumpur, Malaysia

Post by kate_gkl »

I have tried to align the data to the length that I specified in the meta data.

However, when I attempted to view the data, it prompted me an error message:
UnableError executing View Data command:

##E TOIX 000159 11:35:03(001) <Sequential_File_0,0> Short read encountered on import. This most likely indicates one of the following possibilities:

Is there any wrong in my specification when importing metadata? Or i did something wrong in my sequential file stage?

Thanks! Cheers~~~
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

More than likely, yes. :wink: However, it's hard to say what is wrong without seeing both your metadata and your data. I'm a little concerned that you had to "align the data to the length that I specified in the meta data", usually it's the other way 'round. Is this just something you are playing with, so to speak, trying it out to see how it works?

From the error I'd guess that at least one of your records is short. Meaning, if the last field is defined as say, 20 characters, and you've only get 18 characters worth of data in it, then there must be 2 spaces at the end of the record to make up the difference. Any chance of that?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply