I hope this question might be answered before, but i couldnt find it right now so posting this again. I need this urgently.
I have a mapping whose target is flat file and the naming convention is XXXYYY_TIMESTAMP.DAT. Need to know how ot capture the timestamp part in the target file name.
Appreciated your answer!
We can achive this by using Unix script. After completion of session run the following script to rename target file with date. if you want you can change date to time stamp
##Script used to rename file to add time stamp
mv target.txt targetpath/XXXXYYY_$DATE.DAT
I think I missed one more requirement in my question.
In a mapping i have 2 pipelines, one is writing to a target flat file with naming convention as XXXYYY_TIMESTAMP.DAT and another pipeline writes to a header file with the naming convention as XXXYYY_TIMESTAMP.FLG.
The header file should contain the name of the data file as its content (plus counts, flags, which tried achieving using aggregator and expression transformation). how to get the data file name into the header file.
Appreciated your help!
Yuo can achive second one in two ways. One through mapping and second one through scripting.
Easy one is scripting . For header as column names you can use informatica opting if you are using 8 informatica version. This property available in session level target properties.
If you are using Informatica 8.x you can create target file name dynamically. In target designer there is an option to add file name port to the target. You can define your target file name in that port.
Follow below steps to create filename port in target,
1) Goto Target double click on it to open Edit Table window.
2) Goto Columns Tab - > Click on 'F' icon which is located next to New/delete/copy ports icons
3) New FileName Port will be added to the target
4) Now in Expression transformation create a output port for o_FileName and map it to target filename port.
I'm new to informatica and im trying to load 2 tables into a another table
src_Tbl_2:Src_Name --returns only 1 value 'TestDB'
these two tables have no relation at all cannot join , the final target table should look like
tgt_Tbl_3: Sno,name,add, Src_name,Dateinserted.(cannot hardcode the SRC_NAME in the target)
is there a way we can achieve this .
thanks in advance!!
I suggest we go for a trick to join the two tables having no column in common using the sequence generator. As i did, before joining the two create a port say 'SEQ1' and 'SEQ2' in the two sources and let the Seq. generator populate the column. Now we have a common column 'SEQ1' and SEQ2 to give in Joiner transfomration and to load the output.
Hope this resolves.
Does the 2nd table return only 1 value for all rows or has only 1 record ?
Sequence generator will generate a new number for each record, so, even if you use sequence generator, you might miss some records.
Have the 1st table new column and name it "key" - 1 and second table "key" - 1 , so this will give multiple matches, and you can get all records, with the same value.
hope this helps.
Hi My Scenario is little different , i have source file as .dat file and i have to create .dat file as a target (output) from that file with the name "timestamp_source.dat"
source = test_20131008.DAT
output = 20131008.DAT
please provide details steps or idea as i am new to informatica, it is urgent
Could you please elaborate bit more on your requirement ?
You just want dynamic target file name or you want informatica to read dynamic source file name also ?
If it just a taget file name and that too target file name is the part after "_". Than configure your source to have Currentlyprocessedfilename port.
With that read the file name and in expression use the below code to get the source file name with out path.
var_FILENAME=SUBSTR ( CurrentlyProcessedFileName , INSTR ( CurrentlyProcessedFileName , '/' , - 1, 1 )+1 )
Than use SUBSTR(var_FILENAME,INSTR(var_FILENAME,'_')+1) will give you the target file name.
Add filename port also in target and connect it.
This you can do using assignment also but assignment will be based on sysdate..if you want to process some old files you need to modify the code.But using the above process you can process any thing.
For dynamic source read you can use indirect and create list using ls test_*>src_list.txt
and use the src_list.txt as your indirect file.
Thanks For reply .
I have a source as dat file and i have to create output file as .dat file means when i run the mappind it should give me the flat file as output , and the name should contain the timestamp of source file.the Filename you have already told but how to create a file from mapping itself by filename port , i want that port , as i am new i want the steps to follow i have added the source in the mapping and filter but stuck in the mapping to create file
Any help , will be really appreciable
Open your Target flat file defination in Target designer. Double click on it it open the edit window, go to Columns tab..there top right corner you can see icon "F" surrond with dotted square click on that it will add file name port in the column section (You should not add file name port manually it wont work).
Using the source file name derive the target file name as explained in the above post and connect to this port. In the session properties you define any name in target it doesnot matter...but make a note in your target file directory there will be two files one is with zero byte file with the name you mentioned in target properties and second with with the derived target name with actual data.
Please let me know if you need further info in this regard.
Thanks for Reply once again
I guess i am not asking the question correctly
your told in earlier post to open a file in target analyzer , but i dont have file physically present on my machine to open and use in the target window , I have to create the file as output the flow of mapping will be as
source file - > Filters -> transformation - > and then the File creation at the end of mapping
Sorry for troubling you
You have to create Target defination dear, i mean how you want your target to be populated and what are columns needed etc. This is just a defination not a physical file. When you connect the respective ports from source to target columns...Informatica create a physical file with the columns connected in mapping.
So first create target defination and than proceed as i mentioned in my above posts.
Did you try running the workflow atleast once? do you have valid session and workflow ?
We go for debugger once we run the workflow and we didnt get the desired result.I hope in your case some thing problem in session or workflow or may be Server down kind of issue where debugger cant find enough resources to start the process.
Please try to run your workflow once and if you get any error please attach the session log so that we can help you better.