How to ceate a Signal-File when a job has finished OK

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
yserrano
Premium Member
Premium Member
Posts: 52
Joined: Thu Jan 31, 2008 1:23 pm
Location: Santo Domingo

How to ceate a Signal-File when a job has finished OK

Post by yserrano »

I need to create an empty file when a Job has finished OK.

I was trying with an After Job Routine, but the function DSGetJobInfo(DSJ.ME, DSJ.JOBSTATUS) always returns DSJS_RUNNING and I am expecting DSJS_RUNOK.
So, DataStage considers the After Job routine as part of the job process, right?
Any ideas on how to create this file will be appreciated.

The objective of this file is to serve as trigger for another Job in a different job sequence. Do you know of any other common solution to acomplish these dependences? Where one job is waiting for two or more other jobs to finish (without errors).
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your expectation is faulty. :wink:

Technically, 'after job' the job is still running. You have to check the JOBINTERIMSTATUS to find out what status it will end up with (assuming your after job routine doesn't blow up, of course) and create your file based on that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mcs@rajesh
Participant
Posts: 46
Joined: Mon Sep 24, 2007 12:37 am
Location: INDIA

Post by mcs@rajesh »

Have you tried creating the empty file using Touch Command in After Job Routine.
mddw08
Premium Member
Premium Member
Posts: 7
Joined: Fri Apr 18, 2008 1:52 pm

Re: How to ceate a Signal-File when a job has finished OK

Post by mddw08 »

Create a signal file in your after-job subroutine without running DSGetJobInfo and check "Only run after-job subroutine on successful job completion" checkbox.
yserrano
Premium Member
Premium Member
Posts: 52
Joined: Thu Jan 31, 2008 1:23 pm
Location: Santo Domingo

Post by yserrano »

I modified my after-job subroutine as mddw08 suggested.

Code: Select all

JobName = DSGetJobInfo(DSJ.ME,DSJ.JOBNAME) 
Comandd = "touch " :SomePath: "\" :JobName: ".OK"
Call DSExecute("DOS", Command, Output, Result) 
And, checked On the "Only run after-job subroutine on succesful job completion" property.

I am going to try it with different scenarios and if it does not work, I am going to try Chulett's suggestion.

Thank you for your answers.
Post Reply