reading sequential file as a single field

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
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

reading sequential file as a single field

Post by dr46014 »

hi all...
in my last post i asked one question...as per the post i approached the solution but now i m facing a problem
while reading the whole sequential file as a single field as am facing a problem.an error message is showing there.my file has some rows as blank and some rows have data in it.i need to read the whole file as one field.
my file looks like this

name of the company
*******************
*blank spaces here*

generation date :12/10/2006
*blank spaces here*
1256~name1~account_no~ aghik@yahoo.com~12/15/2005
1562~name2~account_no~ aghik@yahoo.com~12/15/2005
1563~name3~account_no~ aghik@yahoo.com~12/15/2005

generation date :12/10/2006
*blank spaces here*
1256~name1~account_no~ aghik@yahoo.com~12/15/2005
1562~name2~account_no~ aghik@yahoo.com~12/15/2005
1563~name3~account_no~ aghik@yahoo.com~12/15/2005

i have choosen the fixed width type and terminator to yes...and also reading it as char and nullable is set to yes.
plz help me how to read the file
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Dont use it as Fixed width. Change it to varchar and have line terminator as none. Pretty much thats it.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

Post by dr46014 »

i dont find any option as line terminator in DataStage..can you please tell me where is that option.
while importing the file there is no option as such... :shock:
BalageBaju
Participant
Posts: 34
Joined: Fri Sep 22, 2006 10:59 pm
Location: India

Post by BalageBaju »

Hi,

Check in the Stage Properties of the Sequential File, In that you can find that Line Termination:
Unix Style
Dos Style
None

In those select the opton None.

This is what Kumar trying to say...
Regards,
Balaji.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Uncheck the fixed width, set terminator to No

Now change the Delimiter to 000 in the Format tab.

You should be able to read it into one field
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

Post by dr46014 »

its working now!!!!!!!11
thanks for ur valuable help
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

Post by dr46014 »

one more help...i need that i should read the date field and pass it as a stage variable to load it into the table..
i want to read only the records not the company name,the ********s and the blank line...
how should i do that
BalageBaju
Participant
Posts: 34
Joined: Fri Sep 22, 2006 10:59 pm
Location: India

Post by BalageBaju »

Hi,

Try with Field Function.

Code: Select all

  Field(i/p_col_name,~,4)
This will give you only the date part, so you can store it in a table.

Hope this will help you.
Regards,
Balaji.
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

Post by dr46014 »

can u plz explan wat that code means..
i want the records in another flat files depending on the creation date
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

dr46014 wrote:can u plz explan wat that code means..
Not to discourage you from asking questions....
You need to do a little of searchon the forum for your answers.
If you don't find solutions, then ask for it.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

You can also find more information about the DataStage functions/transforms/routines in the DataStage Help Menu.
dr46014 wrote: can u plz explan wat
A piece of advice.
u, plz, wat, ur, etc., don't belong to english language. It is always advisable to write your posts using words the right way.

Thanks,
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

dr46014 wrote:one more help...i need that i should read the date field and pass it as a stage variable to load it into the table..
i want to read only the records not the company name,the ********s and the blank line...
how should i do that
I thought i gave you the solution in your other post. You will have blank lines in your target file but then stick another transformer next to it and put a constraint as i specified in my post in the link i provided. That will work. Whats not working there ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Raghavendra
Participant
Posts: 147
Joined: Sat Apr 30, 2005 1:23 am
Location: Bangalore,India

Post by Raghavendra »

Are you able to solve your problem.
dr46014
Participant
Posts: 59
Joined: Fri Dec 08, 2006 11:09 am
Location: bhubaneswar

Post by dr46014 »

yes i got the solution :)
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Care to specify the solution that you had opted and mark the topic as resolved, so the search function can be more efficient for others.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply