You are on page 1of 5

Write(load) data into flat file.

mohan salla 136 posts since Aug 2, 2011


Write(load) data into flat file. Nov 29, 2013 11:45 AM
Dear Experts,
I have to load the data into a flat file and atleast leave first 4 rows blank(I meant say that Data should be written
into file from 5th row onwards in flat file).See below screenshot.

Could anybody advise me asap.


Thanks&Regards
Mohan
flatfile.JPG 29.8 K

Jrgen Freitag 13 posts since Apr 22, 2013


Re: Write(load) data into flat file. Nov 29, 2013 11:59 AM
Hi Mohan,
I suggest to split your workflow in two steps. First you connect the object "Row_Generation" with a query to
your flatfile. Set the amount of rows to 4. It will generate 4 lines with an ID field.
In the output schema of your query you can fill the fields with NULL or blank as needed.
In the second step you export your data as usual.

Generated by Jive on 2016-06-24+02:00


1

Write(load) data into flat file.

Regards
Jrgen

mohan salla 136 posts since Aug 2, 2011


Re: Write(load) data into flat file. Nov 29, 2013 1:43 PM
Thank you for your kind advise and appreciated for your help.
This is not working as I expected.
Suppose source data table has 100 rows and I want to export it to .txt file. I am expecting to see 4 blank rows +
5th row should be column headers and 100 rows.
Could you please send me atl if possible,
Kind regards
Mohan

Arun Kumar
Re: Write(load) data into flat file. Nov 29, 2013 2:54 PM
Hi,
Not tried, but should work i guess. There is an option in the file format editor 'Skip rows'. You can enter a value
there to skip rows.
Have you tried that?
The easiest option would be to insert a post load command with SQL query in a template table and convert
template table to text file.
Thanks,
Arun

mohan salla 136 posts since Aug 2, 2011


Re: Write(load) data into flat file. Dec 3, 2013 3:22 PM
Hi Jrgen,
I tried as you advised but it's keep on over writting first 4 rows and start loading from 1st row and never loaded
the data after 4 rows as expected.I have changed flatfile properies skip rows etc..but no use. Please could you
please advise me.
thanks
mohan

Ancy Selvin 60 posts since Jan 21, 2013


Re: Write(load) data into flat file. Dec 2, 2013 6:58 AM

Generated by Jive on 2016-06-24+02:00


2

Write(load) data into flat file.

Hi Mohan,
Use a BODS script to insert new lines into the file before calling them in DF.
For eg: (if Windows)
In script have :
1)delete the prev run target file present in folder
2) Insert new line to file.
exec('cmd','for %1 in (1 2 3 4) DO echo.>> C:\Users\A\Desktop\M1.txt',8);
3)After script have the DF with target text file with Write row headers enabled and delete file assigned to 'No'.
Now the target should have 4 newlines before the row header.
Similary if the OS is unix have unix command to insert new line.
Thanks,
Ancy

Nagabhushanam Gorantla
Re: Write(load) data into flat file. Dec 4, 2013 5:05 AM
Hi Mohan,
Did you try looking into the options in File Format Editor? Please look into the attachment.

Cheers
Nagabhushanam G
File_Format_Editor.JPG 26.6 K

Rishabh Awasthi 49 posts since May 30, 2013


Re: Write(load) data into flat file. Dec 4, 2013 8:20 AM
Hi Mohan,
Skip rows opton of the File Format would not serve the requirement as it will skip the specified number of rows
of the existing rows of the data being loaded.
Keep the data load flow normal with the Skip row header as NO and Load the data into a file .
After the load into the file join a Script to the data flow executing unix command to prepend the new line to the
existing file.

Generated by Jive on 2016-06-24+02:00


3

Write(load) data into flat file.

Flow:
Dataflow--->Script.
Unix script can perform following steps :
Move the content of the existing file with data to a temp file,
add the required number of line to the existing file,
append the data from the temp file.
But this scenario could take time if the file being loaded is huge.
So better would be to get a Unix script to prepend lines to existing file without using the temp file.
Regards,
Rishabh

mohan salla 136 posts since Aug 2, 2011


Re: Write(load) data into flat file. Dec 4, 2013 5:35 PM
Thank you so much guys for your kind help. Both (Jrgen &Ancy) scenarios were tried and worked as
expected. Thanks alot to Jurgen & Ancy.

naga pulla reddy 6 posts since Oct 15, 2013


Re: Write(load) data into flat file. Dec 5, 2013 10:27 AM
hi..mohan.
I have designed a job based on your requirement .

In query write ifthenelse statement .as below to get the 5th row as header

Generated by Jive on 2016-06-24+02:00


4

Write(load) data into flat file.

Generated by Jive on 2016-06-24+02:00


5

You might also like