flat file with early terminators

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
hobocamp
Premium Member
Premium Member
Posts: 98
Joined: Thu Aug 31, 2006 10:04 am

flat file with early terminators

Post by hobocamp »

I've seen several near-similar posts to this, but not this problem exactly.

I'm reading in a flat fixed width sequential file to a server job. Most records have the correct length. But a few have an early terminator, which breaks the remainder of the record off into a new, shorter record.

By changing some of the parameters in the sequential file properties, i'm able to successfully read the file. But I'd like to put it back out with every line the same length. I've tried using various parsings, using EReplace to remove the early terminator, etc., all to no avail. Does anyone have a suggestion as to how I might remove the early terminator and put out all records the same length?

Thanks for any suggestions.

Tom Smith
kris
Participant
Posts: 160
Joined: Tue Dec 09, 2003 2:45 pm
Location: virginia, usa

Re: flat file with early terminators

Post by kris »

Tom,

I have realised it after posting :lol:

Anyways, thanks for re-posting it in the correct forum.

If you are using datastage to just fix this file, may be not a good idea. You could use a shell script to do it.

I would leave that up to you. Anyways, what exactly did you change on the Sequential file properties so that you could read? Were you able to pad the data after early terminator with those options?

Try space padding the rest of the line after every early terminator. I think you could use space() function in the transformer if you were parsing the data or default padding option on the Sequential file to do that.
~Kris
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Read the as a single very big column to a transform stage.
Do a DCOUNT(In.BigCol,{YourColumnDelimiterCharacter}) to see if the number of columns is correct.
Using stage variables, pass the record on if the count is correct, otherwise store the string and prepend it to the next row's data.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Have you read the file with "Contains Terminators" set for the appropriate column(s)? If so, you can effect your Ereplace() when deriving those columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Have you read the file with "Contains Terminators" set for the appropriate column(s)? If so, you can effect your Ereplace() when deriving those columns.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply