Batch job calling the sequences mentioned in a file.

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
jeet_81
Participant
Posts: 12
Joined: Thu Oct 27, 2011 7:01 am
Location: India

Batch job calling the sequences mentioned in a file.

Post by jeet_81 »

Hi,

I am new to batch jobs. I have a requirement such as I cannot develop a server job and I have 8 sequence jobs which are mentioned in a txt file.Now it may be possible that I may have to run all the sequences or I may have to run few. If I need not runn all the sequences, I comment them.
Could anyone suggest me how I should handle the txt file in a batch job, so that it runs only those sequences which are needed.

The parameters needed for the sequence jobs are defined in the corresponding sequence jobs.
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Re: Batch job calling the sequences mentioned in a file.

Post by BI-RMA »

jeet_81 wrote:I have a requirement such as I cannot develop a server job
Why not? Company regulations? Did you ever realize that a Sequence is basically (using DataStage-Basic) just a server-job in disguise?
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
jeet_81
Participant
Posts: 12
Joined: Thu Oct 27, 2011 7:01 am
Location: India

Post by jeet_81 »

Please aid me in developing a batch job and calling a txt file containing names of the sequences to run.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You need to figure out how to run a job in BASIC because a batch job is all BASIC. If you look under the job properties on a sequence then you can see the code used to run a job. Sequences generate BASIC code. So you can learn how they did it.

When you are in a batch job there is a drop down for adding a job. This will also generate the code to run a job. You will need to change this hardcoded job name into a variable.

You need to get your list of jobs into the batch job. Load them one at a time into this variable and run them.

Code: Select all

DataDirWhereJobListStored = '/usr//data'
openpath DataDirWhereJobListStored to DataDirFilePointer else stop 
JobListFileName = 'JobList.txt'
read JobListRec from DataDirFilePointer, JobListFileName else stop
NoLines=dcount(JobListRec, @FM)
for i=1 to NoLines
JobName = trim(JobListRec<i>)
if JobName[1,1] <> '#' then
   run job here
end
next i

Change the stops to something graceful.
Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

That should get you close enough.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can create batch jobs in the Director client. This batch executes one job after another.

Anything more complex than that you would need to create a sequence job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply