Page 1 of 1

Aborting Job after validation

Posted: Tue Jun 29, 2010 11:22 pm
by adityavarma
Hi All,

I have the below requirement to be done in datastage PX.

1) If source file is empty, the job and main sequence to be aborted

2) If a non-nullable source column receives Null values in the source file,
then we need to stop the loading and abort the job

Can anyone please suggest me on how to proceed on this.

Posted: Tue Jun 29, 2010 11:24 pm
by ray.wurlod
I disagree with the design. I design job sequences that never abort. On that basis, my design would be to run one job to count the rows, check the count, and decide whether or not - on that basis - to proceed with the next job.

Re: Aborting Job after validation

Posted: Wed Jun 30, 2010 1:16 am
by ersunnys
adityavarma wrote:Hi All,

I have the below requirement to be done in datastage PX.

1) If source file is empty, the job and main sequence to be aborted

2) If a non-nullable source column receives Null values in the source file,
then we need to stop the loading and abort the job

Can anyone please suggest me on how to proceed on this.
Hi,

its tricky but possible, in the DS job where you are reading file: In sequential file stage, Set following ::

1. Reject Mode as :: Fail
2. Add Filter in Options and write "grep ^"

In Sequencer's Properties check the check button saying "Automatic Handle Activity that fails"

Please Note :: The job will only abort where non nullable column does not have datatype as VarChar, because for Varchar column DS reads value as "" instead of NULL.

Posted: Wed Jun 30, 2010 1:23 am
by adityavarma
to my luck , all the source coulmns are varchar fileds

Posted: Wed Jun 30, 2010 1:30 am
by ersunnys
adityavarma wrote:to my luck , all the source coulmns are varchar fileds
In that case, you have to do NULL handling in Transformer... check if source column is "" in stage variable and assign some value, and in take a Dummy Link Out from Transformer with Constraint on stage variable = "NULL" and in transformer, Abort After Rows as 1

e.g. take stage variable svCheckNULL as varchar 10

If Source_Column='' then 'NULL' else 'NotNull'

Constraint in transformer as svCheckNULL='NULL' with abort after 1 row

Posted: Wed Jun 30, 2010 1:34 am
by ray.wurlod
Why VarChar(10) if the longest string that will ever be stored in it is seven characters?
:?

Posted: Wed Jun 30, 2010 1:36 am
by ersunnys
ray.wurlod wrote:Why VarChar(10) if the longest string that will ever be stored in it is seven characters?
:? ...
OK.. make it 7, anyways that was just an example...

Posted: Wed Jun 30, 2010 3:30 am
by adityavarma
Sunny,

thank you very much it worked.