Datastage internal variable which reset everyday
Moderators: chulett, rschirm, roy
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
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
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