TomNats
unread,May 13, 2010, 5:39:19 PM5/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Denver Informatica Users Group
There are 3 different ways to create dynamic flat files in
PowerCenter. (that I know of)
=================
1. To append the current system date to the name of a flat file target
in a PowerCenter mapping you can use an expression and the FileName
port as follows:
1. Add a FileName port to the flat file target definition:
1.In the Designer, edit the target definition.
2.Click the Columns tab in the Edit Tables window.
3.Click on the Add filename column to this table icon.
2. Add an Expression transformation before the flat file Target
Definition in the mapping.
3. In the expression use a built-in PowerCenter variable (such as
SYSDATE or SESSSTARTIME) and concatenate that to the file name.
Examples:
trg || SYSDATE || .txt
test_ || TO_CHAR(SESSSTARTTIME,'DD-MM-YYYY') || .dat
4. Link this output port from the Expression transformation to the
FileName port in the Target Definition.
When you connect a port to the FileName port in the mapping the
data passed to it will be used to create the target file name.
=======================
2. Using an operating system command in the Command option you can
enable the session to read the new file name as follows:
1. In the Workflow Manager, edit the session task and go to the
mappings tab.
2. Select the Flat File Source Definition and click the Properties
tab.
3. Set the Input type as "Command" and the Command type as "Command
generating File list".
4. In the Command option, enter the following command (for UNIX):
cd $PMSourceFileDir; ls -1 ABC_`date '+%Y%d%m'`.txt
The command generates a file list from the source file directory
listing and lists all the files generated the same day the session is
run.
When the session runs, the flat file reader reads each file as it
reads the file names from the command
================
3. To append a timestamp to the name of a flat file target using a
PowerCenter workflow variable do the following:
1. Create a workflow variable with datatype NSTRING.
In this example, $$CaptureRunTime.
2. Create an Assignment task before the session and enter the
following expression in the Assignment Task:
$$CaptureRunTime=TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')
3. Edit the session and enter the following file name:
Output filename=FF_Example$$CaptureRunTime.out
FF_Example.txt is the target flat file name as defined in the target
definition.