Datastage internal variable which reset everyday

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Only an environment variable will work reliably and have visibility to all jobs. From a maintenance standpoint this will be easier.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Two environment variables, one to store the counter value, the other to store when it was last updated. If that was yesterday or earlier, reset the counter to 1. You can do this readily through a Routine activity or a before-job subroutine.

Tip: store the date in YYYY-MM-DD format or DataStage internal format, and you can compare it directly to today's date without conversion.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Kenneth/Ray,
Thanks for your time,
Coluld you please elaborate more ? Little detail level please ? :wink:


Thanks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

How about a shell script that sets the environment variable to 1 every day at 00:00:01? Then, another shell script is run every time you wish that environment variable incremented that simply adds one to the existing value and sets it back.

For Ray's example you'll have a script that set to 1 if the environment variable date isn't today (and updates the date variable to today), otherwise it increments the counter variable. For his you'll need to run the sample script everyday at 00:00:01 to reset the value. His solution would require just one script, whereas the way I suggested requires two.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

In Dev environment, I created one environmental variable at Project level by DS Administrator, and at Job level I am defining the value of this parameter as $ENV. Also I am executing shell script in Before-job subroutine. It is working fine.
Post Reply