5 Replies Latest reply on Nov 3, 2017 2:14 PM by Nico Heinze

    Dynamic Target Flat File Name Issue

    Active Member

      Hello I am generating Dynamic Target Flat File Name based on data I read from SQ.


      but if there is zero record processed from SQ then the "FileName" Port isn't working and the 0 byte file has been created with the file name specified is session target attribute "Output filename".


      My requirement is instead of using target attribute "Output filename" it should always generate file with FileName specified, irrespective of file size.

        • 1. Re: Dynamic Target Flat File Name Issue
          Nico Heinze Guru

          If you're working with PowerCenter, then you have to accept that that's the way how the software is implemented.


          Look at it this way: the "designed" target file name (the one you key in on the Mappings tab of the session) is always created (you might view this as a "dummy file"). But as soon as this is created, the actual file name will be taken from somewhere in the mapping (usually an EXP or an AGG).

          However, in order for this mechanism to work, there has to be at least one record flowing through the respective EXP / AGG. If there are no records coming through the respective transformation, then no record with a file name will ever reach the target instance. Meaning no target file can be created.


          If you want to produce empty target files, you will have to find other measures. In PowerCenter that's not possible with a "regular" mapping-oriented data flow if you need a variable target file name; you will need other measures (such as a post-session success command or so) to create empty target files.

          As mentioned above, if no record comes through the mapping to a target instance, then the target file writer will not be activated at all.




          • 2. Re: Dynamic Target Flat File Name Issue
            Vlad Ponomarenko Guru


            I do not really understand what the the output file name  should be.

            I would try to use  Pre- or Post-Session Command.

            Regards, Vlad

            • 3. Re: Dynamic Target Flat File Name Issue
              Nico Heinze Guru

              As of my understanding the issue is this:

              Vijay is setting up a flat file target with a file name port. And he wants empty target files to be created if there are no source records for one particular output file.

              @Vijay, please correct me if I misunderstood you.




              • 4. Re: Dynamic Target Flat File Name Issue
                Active Member

                Yes that is my requirement.

                • 5. Re: Dynamic Target Flat File Name Issue
                  Nico Heinze Guru

                  As mentioned, there's no way to force PowerCenter to create empty target files if you use a dynamic target file name. No way.

                  What you can do is to create a list of statements to create those empty files (based on your input data) and then invoke this script (or batch file, depending on whether you're working on Windows or Unix/Linux) as a post-session success command.