Fixed Width Length

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
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Fixed Width Length

Post by sam334 »

All,
Have a question on fixed width length file. The file has 30 columns. The last column has 12 bytes. So, we put Char(12). In the file there some records which have 11 bytes. So, if we checked suppress row truncation warning, its rejecting some records. If unchecked its aborting on the row where bytes become 11 from 12 bytes (too many records in column).

Any thought how we can achieve this where sequential file will read a fixed width file where in column the lengths are not fixed.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Fixed Width Length

Post by chulett »

sam334 wrote:Any thought how we can achieve this where sequential file will read a fixed width file where in column the lengths are not fixed.
No such thing. If the lengths are not fixed then it needs to be a delimited file. Fixed is fixed, not mostly fixed. :wink:

Question though, is this only an issue with the last field? Does the file have record delimiters in it?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Post by sam334 »

Craig. Thanks. That's what i thought. There is no delimiter. It has always been a fixed width length file. There was a change in source system. After that we are getting the file like that.

The problem is in the last column where the change occurred.

Column looks like,

SS01012005PP which is char(12)
S01012005P which is char (10)

Before it was CHAR(15). So, there was fixed length with spaces at end of each record. Now the spaces are removed.

The file was initially a TRAIL process now changed to NOTRAIL process for which spaces at end of last column truncated.

Is there any way we can read the trailing blanks ?

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

Post by chulett »

Without it being "fixed width delimited" (i.e. fixed width fields but with a record delimiter) then they must ensure that those trailing spaces are preserved as the file is read byte by byte based on the sizes you define. Have the source system correct the file.

You're certain about the record delimiter? A true fixed-width file will look like 'one long record' and will thus give you a wc -l count of 1. If there are standard record delimiters then wc -l will return a 'true' count of the records in the file.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Post by sam334 »

Ok. Thanks Craig. We changed the source file.

Thanks again
Post Reply