To store a value from DB2 table as variable in job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
spracht
Participant
Posts: 105
Joined: Tue Apr 15, 2003 11:30 pm
Location: Germany

Post by spracht »

Aphrodite,

one possibility is to write the value to a hash file (possibly within a sperate job). The hash then can be read using UtilityHashLookup.

Within your controlling job (if you have one) you can read that value and pass it as a parameter to the job that queries the oracle table.

I guess, another approach would be to read the whole oracle table and to exclude the records not needed in a transformer constraint, where again you would use UtilityHashLookup to compare the dates.

Or just read the entire oracle table, do a lookup on the hash described with a surrogate key matching for every record, and again exclude the records not needed by a constraint.

More details and other ideas can be found here:
http://www.tools4datastage.com/forum/to ... C_ID=84730

Kind Regards

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

Post by kcbland »

In your controlling job, execute a SQL script to query your DB2 table and retrieve the date in question. Capture the result, parse for it, and feed it as a job parameter to your DS jobs that need it.


Kenneth Bland
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

To expand briefly on Ken's suggestion, the mechanism would be to call the DSExecute subroutine to run the script, using its third argument to recover the result.
Shell = "UNIX"
Command = "./MySQLscript.sh"
Output = ""
Code = 0 ; * exit status of script after call
Call DSExecute(Shell, Command, Output, Code)

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply