Sequential file Import problem

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Sequential file Import problem

Post by somu_june »

Hi,

HAPPY NEW YEAR

I am facing an import problem when I am trying to read a tab delimited file . When I am running the job, sequential file stage is dropping the records with the following warning


Sequential_File_7,0: Field "SDATE" delimiter not seen, at offset: 27.

I have input data like this in the file

"T#PSR4003 "||Jan 1, 0001||"40"

Where first one is CSE char 11 and second one is SDATE char 12

and in sequential file stage properties I defined properties like this

Record level

Final delimiter = none
Record delimiter = UNIX newline

Field defaults
Delimiter String = ||
quote = double

please help me in solving my problem

Thanks
Soma Raju
somaraju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Only single-character delimiters are supported. You will need to change your file, or process it as a single field and decompose it using Field() functions in a Transformer stage. There will be empty fields between adjacent pipe characters that you can ignore.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Re: Sequential file Import problem

Post by narasimha »

Other options...

If you don't have any pipes in your data (other than the double pipe delimiter),
You could preprocess the file, replace all the '||' with '|'

Another option could be to read the file as is with '|' as the delimiter.
Then in your job you can map only the required fields and ignore the rest.
somu_june wrote:I am facing an import problem when I am trying to read a tab delimited file .
Clarification
Is your file a tab delimited or a '||' delimited?
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
just4geeks
Premium Member
Premium Member
Posts: 644
Joined: Sat Aug 26, 2006 3:59 pm
Location: Mclean, VA

Re: Sequential file Import problem

Post by just4geeks »

narasimha wrote:Other options...

If you don't have any pipes in your data (other than the double pipe delimiter),
You could preprocess the file, replace all the '||' with '|'
By preprocessing, do you mean using awk? Or something in DataStage? Just wanted to check if I got what you meant.
Attitude is everything....
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Re: Sequential file Import problem

Post by narasimha »

just4geeks wrote:[By preprocessing, do you mean using awk? Or something in DataStage? Just wanted to check if I got what you meant.
Not sure how you are related to the OP.
But yes you are right, thats what I meant.
You could do it outside Datastage or build it inside Datastage, your choice.
You can also use sed, which every you are comfortable in.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
naren
Premium Member
Premium Member
Posts: 5
Joined: Mon Jul 17, 2006 8:30 am

Re: Sequential file Import problem

Post by naren »

to my understanding CSE char 11 is "T#PSR4003 "
and SDATE char 12 Jan 1, 0001

if thats the case try varchar instead of char, and add one extra column in metadata at the end and use varchar 3 and let me know whether u got the answer.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I think sed should be enough.
Something like

Code: Select all

sed 's/||/|/' myFile.txt
This searches all occurances of '||' and replaces it with '|'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Missing a "g"?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

What Ray and DSguru2B is suggesting is, use

Code: Select all

sed 's/||/|/g' File.txt > Newfile.txt
either in BeforJobSubroutine or using a Execute command in JobSequence where the job been called, and read the Newfile.txt for you lay out.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

ray.wurlod wrote:Missing a "g"?
Was missing it :wink: , Kumar filled in the space....Thanks Kumar.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Re: Sequential file Import problem

Post by somu_june »

Hi,

My problem was solved and in input data the length of the date field is not constant , for some it has 14 char length and for others it has 12 char length. After making it as constant length, I can load the data with out dropping the records





Thanks,
SomaRaju
somaraju
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Thanks for sharing your solution with everybody.
Now I guess its time to mark your post as resolved :wink:
If possible can give more details on what path you choose, what delimiter you used,....
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
Post Reply