Datastage API -c program.

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

rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Datastage API -c program.

Post by rajan.n »

Hi All,
i have a requirement to write a routine in c language , i.e a datastage API program ,to get the values of DSGetJobInfo, DSGetStageInfo and put it in a seq file.
Ihave done this in a server routine. But there is a prob with that.
Now i want to do the same in Parellel routine.
can any one pls give the code for the following server Routine in C language.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
      ErrorCode = 0
      DirName = Field(InputArg,';',1)
      JobName = Field(InputArg,';',2)

      ProjName = DSGetProjectInfo(DSJ.PROJECTNAME)
      JobHandle = DSAttachJob(JobName, DSJ.ERRWARN)

      JobFile = JobName:"_job.txt"

JobStart   = DSGetJobInfo (JobHandle, DSJ.JOBSTARTTIMESTAMP)
      JobRow = ProjName:",":JobName
      Openpath DirName to jobfile then
         write JobRow to jobfile, JobFile else
            call DSLogWarn("Failed to write file ":JobFile:" to directory ":DirName, "DoJobReport")
         end
      end
      else
         call DSLogWarn("Failed to open directory ":DirName, "LOG_DETAILS")
      end
      close jobfile
Please help in giving the code in the C , or please address some examples so that i can create on my own.

Thanks much in advance.
Rajan.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The logic is essentially the same; consult the Parallel Job Developer's Guide (the chapter on programming with the API) for examples.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi Ray,
thanks for the reply,
am having Version 7.5.1 , i dont see such chapter in my document.
is there any where else..?
thnks
rajan



ray.wurlod wrote:The logic is essentially the same; consult the Parallel Job Developer's Guide (the chapter on programming with the API) for examples. ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would be the Advanced guide, actually.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi Chulett,
thnx for the reply,
is there a chapter naming "programming with the API" in advanced guide ?, can u please refer this properly. because i can see only 7th chapter related to API Datasage Development Kit. in ether documents i could not find chapter Programming with the API .
thanks much again.
rajan.

chulett wrote:That would be the Advanced guide, actually. ...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Look closer. Don't assume the exact name of the section, you're in the right place. I can't check right now, but it's not that hard to find.
-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 »

Pages 7-2 through 7-73 of the Parallel Job Advanced Developer's Guide are about the C-callable DataStage API.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

ray.wurlod wrote:Pages 7-2 through 7-73 of the Parallel Job Advanced Developer's Guide are about the C-callable DataStage API. ...
Hi Ray
thanks for the Information, I read the those pages , but i did not find an example program for any of the function , there are syntax definitions for each function , am sorry to say i failed to make a program with that because this is first time execting this process.
by chance, if u have a C code for a parlell routine Can u please give me
so that based on that i will prepare a c program. for the above server routine.

Thanks much in advance.

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

Post by chulett »

Have you done much C programming? If this is all new for you I'm not sure this path would be recommended.

Why not continue to use your existing routine? Simple enough to use it as is from a Sequence job or some form of job control. I don't really see any burning need to rewrite it in C. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Yes Chulett,
i was happy with my server routine before, but u know there was a problem with a DSGetStageInfo , which is not recognizing the "Dataset stage." gives the error -7 (which means unknown stage in job).

below is the link which am still waiting reply for......
viewtopic.php?t=109955&highlight=DSgetstageinfo


because of this problem , my focus is on parallel routines, (dont know wether this trial works or not , the req is urgent )

comming to C prpgramming , am not that gud enough ,but still i want this routine.

now came with a new doubt.
in advance parallel guide on page number 7-4

Link the application, including vmdsapi.lib, in the list of libraries to
be included.


and

If you want to run the application from a computer used as a
DataStage client, you should redistribute the following library with
your application:
vmdsapi.dll



what this exactly mean how can we "link " and "distribute" can any body clear me on this..?
thanks
Rajan.



chulett wrote:Have you done much C programming? If this is all new for you I'm not sure this path would be recommended.

Why not continue to use your existing routine? Simple enough to use it as is from a Sequence job or some form of job control. I don't really see any burning need to rewrite it in C. :?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I don't see how building a C version will change anything about the behaviour of the API as it relates to specific stages. If you are doing this in the sole belief that it will magically start working with the 'dataset stage', I'd be afraid you are going to be disappointed.

Contact your Support provider, ask them if this is even possible to query passive (or at least certain) stages in Parallel jobs. Regardless of programming language.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Chulett..
thanks for the quick reply.
yes support people were helpless.

and to work on passive stages we use DSJ.STAGELIST1 and for active DSJ.STAGELIST , and for all stages DSJ.FULLSTAGELIST , but here in all trials this gave me same result "-7"

comming to my present C, my belive was , when it failed in server routine may the parllel routine work( jst my trial).
can u please help in the issue now am in.
"
Link the application, including vmdsapi.lib, in the list of libraries to
be included.

and

If you want to run the application from a computer used as a
DataStage client, you should redistribute the following library with
your application:
vmdsapi.dll "

how we do this,
i have created a object file in my personal directory, that linking and distribution part am not understanding.please can u clear me on this..?
thanks much in advacne.
Rajan.


chulett wrote:I don't see how building a C version will change anything about the behaviour of the API as it relates to specific stages. If you are doing this in the sole belief that it will magically start working with the 'dataset stage', I'd be afraid you are going to be disappointed.

Contact your Support provider, ask them if this is even possible to query passive (or at least certain) stages in Parallel jobs. Regardless of programming language.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

rajan.n wrote:can u please help in the issue now am in.
No, not really. My only goal was to try and set some expectations. And (unfortunately) I still think you are ultimately wasting your time. Hope I'm wrong on that.

My C coding days are long behind me and I don't have access to PX here. Others will have to fill that role.
-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 »

Read the description of DSGetStageInfo() carefully. If my memory serves it is pertinent only to active stage types.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rajan.n
Premium Member
Premium Member
Posts: 96
Joined: Mon Oct 09, 2006 7:47 am

Post by rajan.n »

Hi Ray,
I dont mean u are wrong but, when a sequential file has processed , and other passive stages got processed in my test( with FULLSTAGELIST), why not only Dataset stage...??

@chullet,
thnx for the reply.
this is my trial .since the reqirement is urgent i have no other way to try.

@all,
if any one has done the C program for the Parallel routines ,please help me.

Thanks for the quick responces.
ray.wurlod wrote:Read the description of DSGetStageInfo() carefully. If my memory serves it is pertinent only to active stage types. ...
Last edited by rajan.n on Fri May 25, 2007 3:10 am, edited 1 time in total.
Post Reply