Quantcast
Channel: SCN : Blog List - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 222

Save Flat-Files along with current Timestamp(FileName+Timestamp) using Global Variable

$
0
0

Hi,

 

I had a requirement to store Flat Files dynamically along with the current time-stamp attached with filename. When I searched through, didn't find any specific material for the same. So now, As I've implemented it, I'de like to share the process with you

 

  1. Create a Flat File Format provide the location in Root directory where you want to store the file. Leave file name empty here.
  2. Now in your job - Create a global variable e.g. $G_File_Name.  Then take a script before the DF and write the below code in Script - 
    ‘$G_File_Name = YourFileName_'||TO_CHAR(sysdate(),'MMDDYYYY')||'_'||TO_CHAR(sysdate(),'HHMISS')||'.'||'txt';’
    Note: You can change the file extension as per
    requirement. e.g. '.csv' or '.txt'
  3. Assign this global variable ‘$G_File_Name’ as file name to flatfile format in your dataflow where you are using the flat file as Target.
  4. So every time you run the job it will create a file with Filename along with the current timestamp attached to it.
    e.g. In our case it will generate a file as ’YourFileName_11302015_021745.txt’.

 

Thanks,

Gokul


Viewing all articles
Browse latest Browse all 222

Trending Articles