top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Informatica post session command task

+1 vote
682 views

I'm trying to get my Informatica workflow to fail a session if it selected 0 source records. I have come up with the following script to run as the Post-Session Success Command:

if [ $PM{Source Qualifier Name}@numAppliedRows == 0 ]
then
exit 2
else
exit 0
fi

where {Source Qualifier Name} is the name of my source qualifier. When I look at the session log it looks as I would expect where the $PM{Source Qualifier Name}@numAppliedRows is replaced by the number of rows my source qualifier selected but it is still causing the session to fail even when this number is != 0. The session log gives me the following error message:

sh: 0403-057 Syntax error at line 1 : 'if' is not matched.

Any help would be appreciated.

posted Sep 10, 2014 by Amit Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If you are using /bin/sh then you need to put a semi colon (;) after the square brackets.

if [ $PM{Source Qualifier Name}@numAppliedRows == 0 ]; then
exit 2
else
exit 0
fi
answer Sep 12, 2014 by Shweta Singh
What value dou you have in $PM? Do I have to use '{ }' ?


thanks!
Similar Questions
+1 vote

My script ran successfully in Unix but not in a command task of an Informatica workflow. The permissions are fine, and the parameter file and variables have been declared in the workflow. Why is this happening?

0 votes

I tried a simple

if [ 1 == 1 ]; then echo "Hi"; fi >>/projects/ods/Chk.txt
included in the command task but it fails with error code 512....

what am I missing here?

0 votes

am writing a post session shell script where i have to count the target which is a flat file row count and if the count is greater then 500 then send a mail notifying the same. But there are some errors in the script.

DIR="/data/research_dev/inbfiles"
cd /data/research_dev/inbfiles
if [ "$(wc -l ff_invoicepreviewqueue1.csv)" > 500 ]; then
echo "Hi," > InvoicePreview.dat
echo " The row count of InvoicePreviewQueue is:   " >> InvoicePreview.dat
#wc -l ff_invoicepreviewqueue1.csv >> InvoicePreview.dat
echo "                  " >> InvoicePreview.dat
echo "            " >> InvoicePreview.dat
echo "Thanks and Regards," >> InvoicePreview.dat
echo "BI Support team." >> InvoicePreview.dat
mailx -s "Alert!! Count is out of limits!! " "correia.blossom@rexelholdingsusa.com" < InvoicePreview.dat
rm -f InvoicePreview.dat.dat
#
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...