Datastage Routine Function

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

Moderators: chulett, rschirm, roy

Post Reply
sivainsg
Participant
Posts: 4
Joined: Wed Oct 09, 2013 12:39 am

Datastage Routine Function

Post by sivainsg »

Hi All

we have a requirement from our client as below.


a.Fetch all the jobs from all the projects in the datastage server using datastage server routine and determine its start time and end time.
b.We tried using DSGetProjectInfo. But this command only gives the job names of the project on which the routine is actually created.
c.but we want this server routine to return the jobs of all projects irrespective of where this routine is present.

Kindly help me in doing this.

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

Post by chulett »

Does it need to be a 'server routine'? Doing this at the command line via a shell script would be another possibility. Get a list of projects, iterate through the list and then get a list of jobs from each project. then iterate through that list to get their most recent start/end times. All via options within the dsjob utility.

However, you should be able to do something similar from a routine via the API.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sivainsg
Participant
Posts: 4
Joined: Wed Oct 09, 2013 12:39 am

Post by sivainsg »

Hi Chulett

Thanks for your response. Actually we are enhancing one of the Server routines which we have. And this is one of the functions that routine performs to provide the output.

Hence the client mandate is to use the routine to avoid more re work creating all other features which are currently present in the routine which they feel is time consuming.for developement and testing.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

With DSGetProjectInfo() you get a list of jobs.
With DSAttachJob() you get a handle to the job, used by the following routines.
With DSGetJobInfo() you get a lot of details for the job.
With DSGetLinkInfo() you get further information
With DSGetStageInfo() you get further information.
With DSDetachJob() you release the job handle.
sivainsg
Participant
Posts: 4
Joined: Wed Oct 09, 2013 12:39 am

Post by sivainsg »

Hi Arndw

Thanks for your response...

With DSGetProjectInfo() we get only the jobs in the current project. But we need the details of all jobs of all the projects.

Ex:
DSGetProjectInfo() for Project A gives all jobs and its associated details present in project A.

But if there are 2 other projects with A, say A,B,C... We need all the jobs in A,B,C been retrieved in by the routine.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hmm... I can't seem to find an API call to list the projects. There is the "dsjob -lprojects" command line option to list the projects.

Here's a quick and dirty subroutine to list all the project in BASIC:

Code: Select all

Ans = ''
OPEN '','UV.ACCOUNT' TO UvAccount_ptr 
THEN
   SELECT UvAccount_ptr TO 2
   Finished = 0
   READNEXT Key FROM 2 ELSE Finished = 1
   LOOP UNTIL Finished
      READ UvRecord FROM UvAccount_ptr, Key ELSE UvRecord = ''
      IF UvRecord<7>[1,9] = 'DataStage' THEN Ans<-1> = Key
      READNEXT Key FROM 2 ELSE Finished = 1
   REPEAT
   CLOSE UvAccount_ptr
END
ELSE CALL DSLogWarn("Unable to open UV.ACCOUNT","")
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This is far more easily done using the command line tool dsjob - as you note the scope of the routine is its own project.

The alternative is to go through the process of globally cataloging a routine so that it can be called from any project. This is not the preferred approach of the vendor (their preference is to limit scope to the project, for a whole lot of very good reasons), but it is possible. Fairly good "UniVerse" knowledge is required, since the main routine will have to create a PARAGRAPH that invokes the global routine in each project.
Last edited by ray.wurlod on Wed Oct 09, 2013 2:53 pm, edited 1 time in total.
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 »

You can use DSGetProjectList() to get a list of Projects on the server.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig,

I knew that I'd used a function before to get that information and didn't have to resort to reading UV.ACCOUNT (I'll leave the source code up anyway); but I checked the local and online DataStage help files and couldn't find the function and thought that my memory was playing tricks on me. It seems that the function isn't documented (anymore). Thanks!
sivainsg
Participant
Posts: 4
Joined: Wed Oct 09, 2013 12:39 am

Post by sivainsg »

ArndW wrote:Hmm... I can't seem to find an API call to list the projects. There is the "dsjob -lprojects" command line option to list the projects.

Here's a quick and dirty subroutine to list all the project i ...
'

Hi Arndw

I am unable to see your complete post. Could you please help me..
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

sivainsg,

The site is funded through premium memberships and having a couple of user's posts restricted to those premium members. While many of posts are not restricted this one, containing BASIC code, is limited in this way.

Joining up is not expensive and getting just one answer to a problem that blocks you can pay for a whole year's membership many times over.

In addition, my code is not necessary to solve your problem, Craig posted a response and an official API routine call which makes what I wrote unnecessary.
Post Reply