sending reject file if records are rejected.
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
sending reject file if records are rejected.
Hi I need some inputs.
My requirement:
I have 3 requirements which are running fine.
1st UNIX script- Running as expected
2nd job loads the data into sql server table- Running as expected (with reject logic in transformer stage)
3rd job load the status of the job in audit table which is in oracle db- Running as expected
Now I need to send a mail if it rejects any records to the reject file.
Now can any one share their ideas? In the main sequence how to implement this logic.
My requirement:
I have 3 requirements which are running fine.
1st UNIX script- Running as expected
2nd job loads the data into sql server table- Running as expected (with reject logic in transformer stage)
3rd job load the status of the job in audit table which is in oracle db- Running as expected
Now I need to send a mail if it rejects any records to the reject file.
Now can any one share their ideas? In the main sequence how to implement this logic.
Thanks,
M
M
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
Depends how you want to handle it - One way is to have a copy stage after the reject link - one output goes to a file, the other can go to an external target stage that calls an unix mailer ( mailx) - you can tweak this output so that you can summarize the reject statistics in aggregator/transformer stages and pass this as an ouput to the cat command, which can be piped to mailx
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
So... in case it's still unclear what needs doing here... your final UNIX command that gets run after the two "halves" in the stage are put together need to look like one of these two:
Code: Select all
cd \The\Director\Where\TheFile\Lives && wc -m Reject_UK_VAT.txt
-or-
wc -m \The\Director\Where\TheFile\Lives\Reject_UK_VAT.txt
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 96
- Joined: Fri Aug 20, 2010 8:51 am
I wrote unix script which returns a integer value '1'if the file size is >0.chulett wrote:So... in case it's still unclear what needs doing here... your final UNIX command that gets run after the two "halves" in the stage are put together need to look like one of these two:
Code: Select all
cd \The\Director\Where\TheFile\Lives && wc -m Reject_UK_VAT.txt -or- wc -m \The\Director\Where\TheFile\Lives\Reject_UK_VAT.txt
then in execute command for trigger
Convert(@FM,"", shellscriptwhichcheckthefile size.$CommandOutput) > 1
it is working fine it is sending reject file in email as expected.
any way thanks for u r quick inputs
![Smile :)](./images/smilies/icon_smile.gif)
Thanks,
M
M
If running via shell script;
File_len =`cat path/path/file.txt | wc -l'
if file_len > 0
then
mailx command with parms.
Be careful those are tics not apostrophes!
You set sender and recipients to parms.
The sequencer also has a mail stage that can be conditionally called.
if file_len > 0
then
mailx command with parms.
Be careful those are tics not apostrophes!
You set sender and recipients to parms.
The sequencer also has a mail stage that can be conditionally called.
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai