Aborting the Job With Message

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
senthilt1
Participant
Posts: 134
Joined: Mon Nov 19, 2007 2:17 am

Aborting the Job With Message

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Put the data down a separate link from a transform stage that is set to "abort after" 1 row.
swapnilverma
Participant
Posts: 135
Joined: Tue Aug 14, 2007 4:27 am
Location: Mumbai

Post 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.
Thanks
Swapnil

"Whenever you find whole world against you just turn around and Lead the world"
senthilt1
Participant
Posts: 134
Joined: Mon Nov 19, 2007 2:17 am

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted above, use constraints to control what goes down the 'good' link and what goes down the 'bad' link.
-craig

"You can never have too many knives" -- Logan Nine Fingers
senthilt1
Participant
Posts: 134
Joined: Mon Nov 19, 2007 2:17 am

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
senthilt1
Participant
Posts: 134
Joined: Mon Nov 19, 2007 2:17 am

Post 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
Post Reply