to read a txt file without delimiter and fixed length...

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
kannan_ayyanar
Premium Member
Premium Member
Posts: 19
Joined: Sat Apr 17, 2010 10:28 am
Location: Navi Mumbi

to read a txt file without delimiter and fixed length...

Post by kannan_ayyanar »

How to read a txt file without any delimiter in datastage .... help me i n datastage... new to datastage... :P
Last edited by kannan_ayyanar on Sat Apr 17, 2010 3:46 pm, edited 1 time in total.
Kannan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would be a "fixed-width" file, you need to let DataStage know that's what you have. Record Length = fixed, Quotes = none, Field Delimiter = none should get you closer. Make sure you set the field sizes properly so it knows how many characters to read for field.

This is all noted in the Parallel Job Developer Guide documentation, btw.

:idea: Next time, please pick a more meaningful subject for your post, it helps if they are related to your actual issue or question. We already know you're here about DataStage.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kannan_ayyanar
Premium Member
Premium Member
Posts: 19
Joined: Sat Apr 17, 2010 10:28 am
Location: Navi Mumbi

Post by kannan_ayyanar »

thanks for ur response... ya next time i ill specify the issue in the subject... i am new to this forum...

first i explain my prob in detail... txt file s having the transaction details... i wants to capture all the transactions in a column... the number of characters per row s not fixed... first 5 character in a row tells the number of characters in the row.. next 5 characters tells the number of characters of the transaction.. next is transaction details... so like that its keep on appending the transaction details..

so i cant use the fixed length.... first row may contain 5 transactions 2nd row may contain 3 transactions... sp it will be keep on varying... i dont know the maximum number of transactions in a row... suppose if today i am considering 5 transactions might be the max and using the fixed length and capturing in columns tomo 6 transactions may be in a row...
Kannan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Specify the "table definition" to contain one VarChar field.

Please strive to maintain a professional standard of written English on DSXchange.
The second person personal pronoun in English is spelled "your". Ur was a city in ancient Babylonia.
The present tense of the verb "to be" is "is", not "s".
There is no length limit on a post, so abbreviations like "tomo" are not needed.
The reason I ask this is to help those whose first language is not English. Proper English is difficult enough without having to decipher idiosynctratic variations!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

kannan_ayyanar wrote:first i explain my prob in detail...
Would have been best to do that first.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kannan_ayyanar
Premium Member
Premium Member
Posts: 19
Joined: Sat Apr 17, 2010 10:28 am
Location: Navi Mumbi

Post by kannan_ayyanar »

txt file is having the transaction details... i wants to capture all the transactions in a column... the number of transactions per row is not fixed... first 5 character in a row tells the number of characters in the row.. next 5 characters tells the number of characters of the transaction.. next is transaction details... so like that its keep on appending the transaction details..

so i cant use the fixed length.... first row may contain 5 transactions 2nd row may contain 3 transactions... so it will be keep on varying... i dont know the maximum number of transactions in a row... suppose if today i am considering 5 transactions might be the maximum and using the fixed length and capturing in columns tomorrow 6 transactions may be in a row...
Kannan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You didn't need to repeat all that. Ray has already given you the beginning of your answer - read the file as one long varchar. Then substring out the first five characters so you know what to do with that record. So, absolutely no idea what the maximum number of occurances there could be? What's the most you've seen? Perhaps you could pick a reasonable max and code to that.

You might also want to look into the CFF or Complex Flat File stage, it's built to handle COBOL / mainframe structures with things like your 'OCCURS DEPENDING ON'.
-craig

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