Batch ID in Datastage

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

Moderators: chulett, rschirm, roy

Awais Dildar
Participant
Posts: 14
Joined: Mon Dec 04, 2017 10:44 am

Batch ID in Datastage

Post by Awais Dildar »

Hi All,

I have a requirement in designing a parallel job, at each Job run I have to store the Batch ID of the running job in the target table along with records insertion date. I tried to search a lot about getting the Batch ID of a job but found no appropriate solution. Can you please guide me how to get the Batch ID of each Job?
Looking forward for a positive response, thanks in advance.

Regards

Awais Dildar
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

well... have you tried the "whoami" command? You could trap that and set an environment variable in your BEFORE JOB subroutine, or an external source stage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard.

DataStage does not innately generate Batch ID. You have to specify how this is to be generated.

It follows that you can do whatever you like with this generated/retrieved value.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Awais Dildar
Participant
Posts: 14
Joined: Mon Dec 04, 2017 10:44 am

Post by Awais Dildar »

Paul,

Can you please explain briefly how to use "whoami" command to get batch id?
Awais Dildar
Participant
Posts: 14
Joined: Mon Dec 04, 2017 10:44 am

Post by Awais Dildar »

Ray,

Is there any mechanism to implicitly generate this batch ID within a job?
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

I do not think DataStage has a feature called "Batch ID."

Is "Batch ID" some sort of custom column or parameter in your environment?

Have you tried using a parameter?
Choose a job you love, and you will never have to work a day in your life. - Confucius
sriven786
Participant
Posts: 37
Joined: Wed Nov 08, 2017 1:36 pm

Post by sriven786 »

If you are looking for Id generation, there are several ways, You can generate taking the Max_Id + 1. What's the purpose of this Id in your Table?
Venkata Srini
Awais Dildar
Participant
Posts: 14
Joined: Mon Dec 04, 2017 10:44 am

Post by Awais Dildar »

No, I'm not looking for simple Id generation; its pretty much simple. I just wanted know the exact batch Id under which a job is being executed on daily basis for CDC.
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

He is looking for the ID that ran the job.

Awais. Log in to your host, go to the command line and type whoami.
sriven786
Participant
Posts: 37
Joined: Wed Nov 08, 2017 1:36 pm

Post by sriven786 »

As mentioned, DataStage doesn't a feature called "Batch ID." In my previous project, we used to generate Job_Id whenever the Job Sequence starts and use log that id to Job Table to track the Job start and end and which job has inserted/updated/deleted along with the creation date and last updated date.
Venkata Srini
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

you can parse the current timestamp or job start timestamp out (remove : chars) and put it into the invocation id field which you can then see in the debugging tools and if you want you can store that in a column somewhere to tie it all together for debugging purposes.

there are other ways to do it ... we have a system that has a table where we store job name & run# and the data is stamped with run# as well
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't think "Batch ID" and "User ID" are equivalent here. :?

Can you define what your term means using other words, something other than simply "batch id"? Is this value something you're already seeing somewhere, say in a log entry and if so can you show it to us? I think it would go a long way towards lessening the confusion around what exactly it is that you need - an existing field you are aware of and need to capture, or something that currently does not exist that you need to generate. It does not seem to be the latter you are looking for but wanted to confirm.
-craig

"You can never have too many knives" -- Logan Nine Fingers
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

My bet is on "Batch ID" is the user id that is running the job in production, as opposed to some type of watermark value.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We knows. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

A batch ID from what I have seen is an integer to track the records being inserted/updated during Job run. Mostly for audit purposes. And that needs to be generated before each job execution, a separate piece of code.

But only OP knows what he really wants.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply