capturing Job's Version Number for audit meta-data

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
katz
Charter Member
Charter Member
Posts: 52
Joined: Thu Jan 20, 2005 8:13 am

capturing Job's Version Number for audit meta-data

Post by katz »

Hi,

I want to capture a job's version number (i.e. the version number in the General tab of the Job Properties window) in my runtime meta-data. A perfect solution would be a using an InfoType in the DSGetJobInfo function, but this does not seem to be supported (at least its not documented). Neither does the version number appear in the output of the DSMakeJobReport function.

Are there any other means that I use to obtain the job's version number?

Thanks,
katz
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Are you Releasing your jobs? That's the only process that increments that value, from what I recall, unless you are doing it manually...
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Version Control also increments the version number, and it's possible that developers do also.

You can query the Repository using a "UV" command in DSExecute.

Code: Select all

SELECT NAME, EVAL "@RECORD<8>" AS VERSION FROM DS_JOBOBJECTS WHERE OBJTYPE = 'J' AND OBJNAME = 'ROOT' AND OBJIDNO = (SELECT JOBNO FROM DS_JOBS WHERE NAME = '<<Job Name>>') COL.SUP COUNT.SUP;
You will need to parse out the penultimate field from the result.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Doh! Forgot that little tidbit. :lol:
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ray is correct. The result for a job might be 50.1.0 which would indicate version 1.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Here's a cute variation on the theme, retrieving the result as a single expression (for example to set a job parameter value). You need the job name from somewhere.

Code: Select all

Trans("DS_JOBOBJECTS", "J\" : Trans("DS_JOBS", JobName, 5, "X") : "\ROOT", 8, "X")
It returns a zero length string if the job is not found.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
katz
Charter Member
Charter Member
Posts: 52
Joined: Thu Jan 20, 2005 8:13 am

Post by katz »

Thanks Mucho! I have it working now. The proof-of-concept Routine is below.

From this point there are a couple of directions that I can take it...
...obtain the job version of a specfic job at run-time, to include with my job run audit data.
...generalise it a bit and select the job names and versions for all jobs LIKE the input argument (i.e. what are the job versions running in Production for all jobs LIKE 'abc%').

katz

Code: Select all

FUNCTION TestJobVersion(Arg)
      v_Cmd = ''
      v_Cmd = "SELECT JOBNO TO SLIST 9 FROM DS_JOBS WHERE NAME = '":Arg:"';" 
      Perform v_Cmd 

      * Convert Select List 9 into dynamic array 
      ReadList d_jobNumber From 9 
         Then v_jobNumber = d_jobNumber<1> 
         Else 
              Ans=-2 
              Return(Ans)
         End 

      v_Cmd = ''
      v_Cmd = "SELECT  EVAL '@RECORD<8>' TO SLIST 9 FROM DS_JOBOBJECTS WHERE OBJTYPE = 'J' AND OBJNAME = 'ROOT' AND OBJIDNO = '":v_jobNumber:"';"
      Perform v_Cmd

      * Convert Select List 9 into dynamic array 
      ReadList d_jobVersion From 9 
         Then Ans = d_jobVersion<1> 
         Else 
              Ans=-1
         End

RETURN(Ans)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How about:

Code: Select all

FUNCTION TestJobVersion(TheJobName)
* Returns job version number if found, or "" otherwise

Ans = Trans("DS_JOBOBJECTS", "J\":Trans("DS_JOBS", TheJobName, 5, "X"):"\ROOT", 8, "X")

RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
katz
Charter Member
Charter Member
Posts: 52
Joined: Thu Jan 20, 2005 8:13 am

Post by katz »

Thanks Ray,

That is a certainly lot more elegant. It even seems to run faster. A clear improvement. I've not worked with the TRANS or XLATE functions until now; it seems like a bit of a play-about is in order. :)

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

Post by ray.wurlod »

XLATE is a synonym for TRANS, as your researches will have revealed.
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