Aborting Job after validation

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
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Aborting Job after validation

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ersunnys
Participant
Posts: 29
Joined: Wed Sep 13, 2006 1:39 pm
Location: Singapore

Re: Aborting Job after validation

Post 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.
Regards,
Sunny Sharma.
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

to my luck , all the source coulmns are varchar fileds
ersunnys
Participant
Posts: 29
Joined: Wed Sep 13, 2006 1:39 pm
Location: Singapore

Post 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
Regards,
Sunny Sharma.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why VarChar(10) if the longest string that will ever be stored in it is seven characters?
:?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ersunnys
Participant
Posts: 29
Joined: Wed Sep 13, 2006 1:39 pm
Location: Singapore

Post 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...
Regards,
Sunny Sharma.
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

Sunny,

thank you very much it worked.
Post Reply