Problem When Writing to Sequential File

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
Vinodanand
Premium Member
Premium Member
Posts: 112
Joined: Mon Jul 11, 2005 7:54 am

Problem When Writing to Sequential File

Post by Vinodanand »

Hi,

When I'm writing to a Fixed Width File I'm getting the Following Warning.

MedPxiProcessJob.953.MedPxiOut1_Seq.PXI_OUT_1_Lnk: put_fixedwidth() - data for column MED_NON_COVD_REAS_CD exceeds column width (4), row 39711 (approx), data = T42

The Column is Of type VarChar and length is 4 . But when i checked the data its only 3 char long.

I am getting similar error for another column of dataype VarChar and length 6 .

The only thing which is common is that the data for the above types is of length 3. So does that mean that when the length is specified as 4 or 6 or more the data should contain 3 or more characters.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you add a dummy column to your output with the derivation of LEN(PXI_OUT_1_Lnk.MED_NON_COVD_REAS_CD ) to make 100% certain that this string is of length 3 and doesn't contain padded spaces and/or non-displayable characters? The length limitation given in DataStage server jobs will not truncate a string that is longer - for instance, if your source data reading from a sequential file contains "Hello World" while the definition is VarChar(5) it will keep the full string in DataStage, and potentially give an error message when writing to a fixed-length field smaller than 11.
Vinodanand
Premium Member
Premium Member
Posts: 112
Joined: Mon Jul 11, 2005 7:54 am

Post by Vinodanand »

Hi,

Thnx arnd for ur prompt rep. I have checked for any tailing characters but there seem to be none. Is there any way out ... as i'm gettin an warning only.... The filed Incomplete Column in Sequential File Stage is set to warning ... Does this have any impact ....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How can you have a Varchar in a fixed width field file? :? Change it to a Char.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Vinodanand
Premium Member
Premium Member
Posts: 112
Joined: Mon Jul 11, 2005 7:54 am

Post by Vinodanand »

Arnd for one of them when i used a Len function it did show an extra character . I checked the File for but it is inch perfect in the file . The Column is of length 6 and my data is of length 3 and its padded up with 3 spaces. Is there any other way of debugging this ...
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Force a length by using a derivation like In.ColName[1,3] to limit it to 3 chars regardless of source length. Does the error still occur?

And I am quite confused by you saying that in some cases you found an extra character but the file was perfect.

It is never wise to mix CHAR and VARCHAR types and relying on implicit conversions in Server jobs. Explicitly TRIM and PAD your strings when you output to a fixed length file.

You can change your file format to variable length to help you debug your problem - you can then use an editor to see the file line 39711 and it's contents. Best to use a binary editor to see unprintable characters instead of the normal vi.
Vinodanand
Premium Member
Premium Member
Posts: 112
Joined: Mon Jul 11, 2005 7:54 am

Post by Vinodanand »

Thnx arnd, it did solve my prob...
Post Reply