Stop creation of files if the constraint does not satisfy.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
yatin.mittal
Participant
Posts: 20
Joined: Fri Oct 14, 2005 12:52 am

Stop creation of files if the constraint does not satisfy.

Post by yatin.mittal »

Hi,

I have a very simple probelm but I am not able to resolve it.
In a job, I am having a transformer stage, where I am having suppose 4 conditions based on which 4 output files will be generated. In scenarios, when my input records satisfy only 3 conditions, then the 4th file should not be created as the constraint to this file is not satisfied.
But what is happening is that it is creating an empty file.

I dont want to have that empty file.
Is there any possible solution in the job itself so that I can stop creation of files in cases where the constraints are not satisfied ?

Thanks,
Yatin Mittal
Accenture Services Pvt. Ltd.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

One solution would be to delete the file using unix shell script or commands if the file is empty. Call the uhix script from after stage subroutine or after job subroutine.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Indeed that, or something similar, is the ONLY solution.

You can not prevent the Sequential File stage from creating a file (provided permissions allow).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sb_akarmarkar
Participant
Posts: 232
Joined: Fri Sep 30, 2005 4:52 am
Contact:

Post by sb_akarmarkar »

Hi,

Four output links from transformer to four output files and four condition
Then three you have fourth you want if three of any fails or all three fails....If i understand correctly then following will help

Order the links
Just use..... NOT(link1.condition1 and link2.condition2 and link3.condition3) in constraint of link4...for all three fails
NOT(link1.condition1 or link2.condition2 or link3.condition3) ....for any of fails.
No ouput no file creation... :D

Thanks,
Anupam
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Umm... no. As noted, the Sequential stage will always create an empty file when it is 'opened' - it cannot be avoided.

If you don't want the file, check the file(s) for a zero size 'after job' and delete them if they are.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply