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
Implementing If/Then
Moderators: chulett, rschirm, roy
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
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
http://www.tools4datastage.com/forum/to ... C_ID=85322
I believe this is the link for finding file size posted by Kim Duke.
thanks
I believe this is the link for finding file size posted by Kim Duke.
thanks
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
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