Page 1 of 1
Aborting the Job With Message
Posted: Mon Jun 09, 2008 4:27 am
by senthilt1
Hi All,
I have to abort the job, whenever the IF condition Fails.
Eg:
If(Len(IN.Col) <= 15)
IN.Col
else
Abort the job with message("Bank Account ID is defined as decimal(15)");
end;
Please let me know, how to achieve this.
Thanks,
SenthilP
Posted: Mon Jun 09, 2008 4:56 am
by ArndW
Put the data down a separate link from a transform stage that is set to "abort after" 1 row.
Posted: Mon Jun 09, 2008 6:06 am
by swapnilverma
Check this condition in stage variable .
StagVar = If(Len(IN.Col) <= 15) then True Else False
Add constrain in transformer
If Stagevar = False check the abort option
plz Let me know if did not work well.
Posted: Mon Jun 09, 2008 6:11 am
by senthilt1
HI ArndW,
Thanks ArndW for your view.
If I put a separate link with "abort after" 1 row in transformer stage. It will abort the job after a row is passed, whatever the derivation may be. Correct me if I am wrong.
But for my case, I have a o/p schema having 4 cols, In it one of the col have the derivation using if then else. If the condition satisfies pass as it is, If fails, i want to abort the job then only with the error message as we type in.
Please let me know about this,
Thanks,
Senthil P
Posted: Mon Jun 09, 2008 6:38 am
by chulett
As noted above, use constraints to control what goes down the 'good' link and what goes down the 'bad' link.
Posted: Mon Jun 09, 2008 6:57 am
by senthilt1
HI Swapnilverma,
Thanks,
Whatever you said, will definitely work out to abort the job whenever the condition fails. But in addition to this, i have a other requiremnt. The log message for the job abort should include my comments too.
For my case , the log info should include "("Bank Account ID is defined as decimal(15)")" .
Hope you understand my problem. Please let me know about this.
Thanks,
Senthil P
Posted: Mon Jun 09, 2008 7:01 am
by ArndW
There is no simple, builtin facility in PX jobs to generate a message in the log file. Do you really need to do this? I might output this message to a PEEK() stage in the reject link and use that log message to diagnose the error in this case.
Posted: Mon Jun 09, 2008 7:05 am
by chulett
Why not include the 'reject message' on the aborting link? What do you ultimately need to do with this? The presence of a non-zero byte file could trigger an email with the file as an attachment, something easier than fishing the error out of the job logs.
Just a thought.
Posted: Tue Jun 10, 2008 2:23 am
by senthilt1
Hi All,
I resolved this issue in this way,
Seqfile--->Transformer--->Output File
|
|
Peak Stage
I set the stage variable for the IF condition fail=0 , pass=1.
In constratint Stagevar=1 then passed the Input to the output
In Peek stage constraint I kept Stagevar=0 and abort after rows 1. Also in peek stage, i have created the column called LOG_MESSAGE , kept the value as "Whatever i wanted to see in the log file" and i displayed this column in log file.
Its fine now.
Thanks ArndW for your Peek Stage info on this,
Also Sincere Thanks and Wishes for your 10,000 Posts.
Senthil P