Page 1 of 2

Datastage API -c program.

Posted: Mon May 21, 2007 5:03 am
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.

Posted: Mon May 21, 2007 5:54 am
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.

Posted: Mon May 21, 2007 6:22 am
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. ...

Posted: Mon May 21, 2007 6:49 am
by chulett
That would be the Advanced guide, actually.

Posted: Mon May 21, 2007 7:27 am
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. ...

Posted: Mon May 21, 2007 7:58 am
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.

Posted: Mon May 21, 2007 3:20 pm
by ray.wurlod
Pages 7-2 through 7-73 of the Parallel Job Advanced Developer's Guide are about the C-callable DataStage API.

Posted: Thu May 24, 2007 2:12 am
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.

Posted: Thu May 24, 2007 7:07 am
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. :?

Posted: Thu May 24, 2007 7:33 am
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. :?

Posted: Thu May 24, 2007 7:47 am
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.

Posted: Thu May 24, 2007 8:09 am
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.

Posted: Thu May 24, 2007 8:54 am
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.

Posted: Thu May 24, 2007 3:23 pm
by ray.wurlod
Read the description of DSGetStageInfo() carefully. If my memory serves it is pertinent only to active stage types.

Posted: Thu May 24, 2007 11:00 pm
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. ...