8 Replies Latest reply on Aug 3, 2020 9:12 PM by Seema Yaligar

    Empty file issue

    EC137656 Seasoned Veteran

      Hi,

       

      im using a post session success command to get the session stats like source count , target count and wkflw name using dos command.

      when the source count is >0 it is writing the data to the file but when source or target count is 0 then it is writing with empty file.

      im using session built in parameters $PMSourcequalifier@numAffectedrows ,$PMTargetName@numAffectedrows ,$PMWorkflowName.

       

      i was expecting it to write with workflowname,0,0 when no records count is 0 but it is writing with empty file.

      any inputs on this issue?

        • 1. Re: Empty file issue
          Nico Heinze Guru

          Plainly spoken I don't understand your question.

          Everything up to the "when the count is 0" is clear, but what do you mean with the remainder? What is written as an empty file? Which file is empty?

           

          BTW it is technically clear that if there's no input then there's an empty output file (instead of no file at all). This works as designed and is nothing new; target files are always created, and if there's no input, no output data will be written to the empty file.

          (OK, this is a bit simplified, but I hope you understand what I mean to say.)

           

          Regards,

          Nico

          • 2. Re: Empty file issue
            EC137656 Seasoned Veteran

            Nico,

             

            im echoing the below parameters to a file , but when the source record count and target record count is 0 will it not write 0 to a file along with workflow name? 

            below is my command

            echo $PMSourcequalifier@numAffectedrows ,$PMTargetName@numAffectedrows ,$PMWorkflowName > stats.txt

             

            below is what im expecting

            wkfwname,0,0 or workflowname,,

             

            but my file is empty.

             

            hope this gives you some clarification on my request.

            • 3. Re: Empty file issue
              Nico Heinze Guru

              Thanks, that makes it indeed clear.

              To be honest I'm as surprised by you, I wouldn't have expected an empty file in the post-session command.

               

              One question: is ">stats.txt" indeed the full redirection? Or did you give a path to the stats.txt file which you have not written here?

              The reason for this question is that all command tasks will be executed in $INFA_HOME/server/bin, and in many cases this is a write-protected directory, so giving a full directory path here might prove helpful.

               

              Regards,

              Nico

              • 4. Re: Empty file issue
                Rajan Rath Guru

                This could very well be a possibility of permission issue.

                Can you try redirecting the file to a location where the user has permissions (hardcode the path) and check if that works?

                • 5. Re: Empty file issue
                  EC137656 Seasoned Veteran

                  Hi,

                   

                  im using path where i can write , one thing what i observed it is sometimes writing with the details sometimes with empty file. Looks like this is not a  reliable  approach and iam going with alternate solution.

                  • 6. Re: Empty file issue
                    Rajan Rath Guru

                    From an application perspective, either the output is written or not-written.

                    If the output is written at times and not in certain executions, it has to be something related to configuration; as the application should not behave differently at different points.

                    • 7. Re: Empty file issue
                      EC137656 Seasoned Veteran

                      Hi Rajan,

                       

                      my requirement has changed now , im not using @affectedNumRows to get the counts, im using session log to parse the details.

                       

                      Is there a code to parse the informatica session log details to get the record counts for source and target?

                      • 8. Re: Empty file issue
                        Seema Yaligar New Member

                        Hi EC137656

                         

                        Unfortunately, We don't have any code to parse the session log and get the source and target record counts.

                        However you can follow the below discussion it might help you.

                        Session Log information to be loaded into a table after session run completes

                         

                        Thanks,

                        Seema