Scheduling DataServices jobs

Dear Team,

I have a job in Data Services (ETL) which i want to run on every wednesday.
For this job I need a date parameter(‘2017.01.01’) which is previous monday and business_name parameter(‘ABC’)

for example: I am running a job on 2017.01.03 then my date parameter will be 2017.01.01.
If I am running a job on 2017.01.10 then my date parameter will be 2017.01.08.
Similarly by business _name parameter will also keep on changing.

How can i automate this… please help me with your ideas…

Thanks,


BODS-Help (BOB member since 2017-02-21)

Global variables can be modified in a script or in the parameters for each run. Probably they will serve your purpose.

  • E

eepjr24 :us: (BOB member since 2005-09-16)

[quote:352b856db6=“BODS-Help”]Dear Team,

I have a job in Data Services (ETL) which i want to run on every wednesday.

[/quote]

That part is simple. Assuming you are using the standard Data Services scheduler (and not a third-party scheduler), just go into the Data Services Management Console / Administrator section.

Navigate to the appropriate repository and job, select the “Batch Job Configuration” tab (middle one), select the “Add Schedule” link for your job.

In the Schedule setup screen, change “Day of month” to “Day of week” and make sure that only Wednesday (“Wed”) is highlighted/selected… and Bob’s your uncle.

This can simply be done by using a bit of scripting and either Global or Local variables. Let’s just assume Global Variables if you’re not familiar with passing local variables to lower-level DF/WF parameters, etc.

I’ve done this in little steps here, just so it’s easier for you to read:


$G_Date = datetime
$G_Day_In_Week = int
$G_Day_Delta = int

$G_Date = sysdate();                     # Current date of running the ETL job
$G_Day_In_Week = day_in_week($G_Date);   # Gives us the current day in the week, ranging from Monday (1) to Sunday (7)
$G_Day_Delta = $G_Day_In_Week - 1;       # Number of days between today and Monday. E.g. if it's Friday now, Monday was 4 days ago.
$G_Date = $G_Date - $G_Day_Delta ;       # Subtract X days from current day to get last Monday's date

However, I would only use 1 Global Variable at most if that needs to be referenced across the job and only use Local Variables for this. Or just wrap it in a custom function to create a reusable object for use in other jobs. (A script object itself is not reusable but if you contain it in a reusable Work Flow object, it will become reusable though a custom function is probably a neater solution.)


ErikR :new_zealand: (BOB member since 2007-01-10)