Multiple conditions in Routine

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Multiple conditions in Routine

Post by Developer9 »

Hi Gurus ,

How do i write multiple conditions in a routine? i need it like mentioned below , but i am getting compile errors when i do it like this. I tried putting all 3 conditions in brackets , tried comma , semicolon at the end still gives compile errors.

Code: Select all

 If Status = DSJS.RUNFAILED  Then
    ErrCode = DSRunJob(JobHandle, DSJ.RUNRESET) 
    ErrCode = DSDetachJob(JobHandle)  
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
ELSE 
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
Compile Error :
0054 ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL) ELSE

^
"ELSEEOL" unexpected, Was expecting: ';', End of Line
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Dang... been a long time but try:

Code: Select all

If Status = DSJS.RUNFAILED  Then 
    ErrCode = DSRunJob(JobHandle, DSJ.RUNRESET) 
    ErrCode = DSDetachJob(JobHandle)  
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL) 
END ELSE 
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
END
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Despite it being a long time, Craig has correctly remembered the "multi-line" or "block" format. The block of statements needs to be terminated with an End statement.

You won't be able to run a detached job.

I prefer initial capitals to all upper case, though keywords in the BASIC language are case insensitive.

Code: Select all

If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED  
Then 
    ErrCode = DSRunJob(JobHandle, DSJ.RUNRESET) 
    ErrCode = DSDetachJob(JobHandle)  
    JobHandle = DSAttachJob(JobName, DSJ.ERRNONE)
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL) 
End
Else
    ErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL) 
End
Last edited by ray.wurlod on Wed Oct 08, 2014 8:30 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yay me! :D

Sorry, didn't even look at the actual code for sense making.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Developer9
Premium Member
Premium Member
Posts: 187
Joined: Thu Apr 14, 2011 5:10 pm

Post by Developer9 »

You guys Rock ....

Thanks
Post Reply