software_art
software_art

Reputation: 57

how to create an informatica flat file with dynamic name and trailer

I am creating a dynamic name flat file in informatica powercenter. I have to accomplish two tasks: create a flat file with timestamp appended to it's name, and also append a trailer having the record count to the flat file. I am able to perform the above two tasks separately but i am not sure how i can accomplish them together. If i create a flat file with timestamp info using informatica file name port and use a unix script in a command task to append the trailer how can i refer to the variable file name in my unix script. I am using the following command to refer to the output file name generated by informatica:

file='ls output_file.txt' 

here the name of output file is not variable. I wanted to know how can i call an output file with a variable name in this command or the script itself.Any help is appreciated.

Thanks

Upvotes: 0

Views: 3369

Answers (2)

user1250264
user1250264

Reputation: 905

Here is my approach

  1. Create a FileName variable in Expression.
  2. 'Filename_'||to_char(PERSON_ID)||'_'||to_char(sessstarttime, 'MM-DD-YYYY_HH24miss')||'.txt'

I added the PERSON_ID to add another ID unique identifier but its an option

Upvotes: 0

Maciejg
Maciejg

Reputation: 3353

Try this:

  1. Create workflow variable, e.g. $$TargetFileName
  2. Create an Assignment Task and assign the desired name to the variable, e.g. 'output_file_' || TO_CHAR(SYSTIMESTAMP(), 'YYYYMMDDHHMISS') || '.txt'
  3. Use a post-session command (e.g. wc -l < $$TargetFileName >> $$TargetFileName) to add the line count to the output file.

Upvotes: 0

Related Questions