Transforming a delimited file into a non delimited 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
jshurak
Participant
Posts: 74
Joined: Mon Jan 09, 2006 12:39 pm

Transforming a delimited file into a non delimited file

Post by jshurak »

I need to take a delimited file with four columns and transform it into a nondelimited, one field file. Any ideas?
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Read the Delimited Sequential File.
Concate the columns in the transformer using : (colon) operator and write into the one Field on the target file. Pretty Straight, right?
Or you have anything else. :?
Success consists of getting up just one more time than you fall.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or Read your file and load it to another sequential file with delimiter and quote character set to 000. Just a straight load.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Give the output delimiter as none (000).
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A 'nondelimited one field file' could also be generated as a 'Fixed Width' file simply by checking that option. Same thing. You'll still need to set the quote character to '000'.

Or as noted, specifically concatenate all fields into one big one.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

A non delimited one field file, yes.
A fixed width file, i am not too sure about that.
If thats what the OP wants then he has to make sure that if a field is defined as length 10 and an incoming value has only 8 bytes, he needs to cat 2 extra spaces to it to make it a truely fixed width file. A little bit more effor for a fixed width file than just setting the delimiter to '000'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DSguru2B wrote:A non delimited one field file, yes.
A fixed width file, i am not too sure about that.
If thats what the OP wants then he has to make sure that if a field is defined as length 10 and an incoming value has only 8 bytes, he needs to cat 2 extra spaces to it to make it a truely fixed width file. A little bit more effor for a fixed width file than just setting the delimiter to '000'
No, not necessarily... a fixed width file can 'fix' things itself just fine. Using 'char' for the character types helps tremendously, for example...

Give it a shot before you pass judgement, it can be as simple as checking the option.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Actually you are right. Sorry, i am still learning :oops:
Thats why i said "I am not too sure"
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It really depends on what the OP needs. If the fields can be strung together willy-nilly, each piece picking up where the previous piece ends, then all this 'concatenation' advice is fine.

If the fields need to be of a certain consistant size, starting and ending in consistant positions with no delimiters between them, that is by definition a fixed width file. And if you build one by padding and concatenating the fields yourself, you are taking the wrong approach. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Very true. I, just wasnt sure, if datastage padds spaces to honor the length on its own just by specifying the sql type as 'char'. Thats why my concern to do it explicitly.
But as i told you before, your officially my mentor. :wink:
Learn something new from you every day.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

You can specify how to pad, either globally or on an individual field level. Some you may want space filled, others zero filled. It's all in there...
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Post Reply