Page 1 of 1

Posted: Thu Oct 09, 2003 8:31 am
by kduke
raggid

"If/then/else" can return 2 values. You can trick it into doing an "elseif" by concatenating an empty string to the else. Try:

If x=1 then 1 else "": if x=2 then 2 else "":if @true then 3

Kim.

Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com

Posted: Thu Oct 09, 2003 8:46 am
by kduke
raggid

Sorry I misunderstood the question. If a source file is empty then the job will finish just process no rows. You could do it in a routine. I posted the code yesterday to get the length of a sequential file. Just use that in a constraint.

Kim.


Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com

Posted: Thu Oct 09, 2003 9:49 am
by gpbarsky
Kim:

Could you specify me where did you post the code for checking the length of a sequential file ?

Thanks.


Guillermo P. Barsky
Buenos Aires - Argentina

Posted: Thu Oct 09, 2003 10:36 am
by raju_chvr
http://www.tools4datastage.com/forum/to ... C_ID=85322

I believe this is the link for finding file size posted by Kim Duke.


thanks

Posted: Thu Oct 09, 2003 11:53 am
by kduke
raggid

Each output link has a constraint. A constraint has to be true if any records are to written.

Here is the code that you need to build around a routine but you just stated that these are hash files.

file = "KDBPOpenSeqSize.uvb"
openseq file to SeqFile else stop
status FileInfo from SeqFile else stop
FileSize = FileInfo
print FileSize

Hash files would be different. Your issue can be solved easier than I thought.

Job 1 has a before routine which writes a "0" into a hash file. Create a hash file with one record then update this record if any rows are written in this job. Have a constraint with if @OUTROWNUM = 1 so only one row gets written. Make the key = "Results".

Job1:
hash1 -> transform -> normal output1
. -> output2 HashResults, "Results"

If no rows are in hash1 then HashResults, "Results" has a "0 in it.

The next job will need to lookup HashResults, "Results" and if there is a "0" then do not output anything.

Job2:
hash2 ->
HashResults, "Results" -> transform -> normal output1

Routine1:


open "HashResults" to HashResults then
Opened = @true
end else
Cmd = "CREATE.FILE HashResults DYNAMIC"
execute Cmd capturing output
open "HashResults" to HashResults then
Opened = @true
end else
Opened = @false
end
end
if Opened then
write "0" on HashResults, "Results" else Opened = @false
end
Ans = Opened
.
.
.



This should get you close.

Kim.


Kim Duke
DsWebMon - Monitor DataStage over the web
www.Duke-Consulting.com