Job elapsed in DSGetjobinfo

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
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Job elapsed in DSGetjobinfo

Post by India2000 »

Hi Friends,

I need your help in understanding Of jobelapsed return info type from the DSGetjobinfo.

It's a char pointer to JobElapsed. DSGetjobInfo says it returns elapsed time of the job in secs.

Does anyone know how exactly it returns the result?

Is it in the time formal like 00:00:04 for 4 secs or just 4 secs.

Is there any conversion required once it returs char * value. I get Sigsegv error in the parallel routine when I set return value to char * in the Datastage parallel routine.

Is this a known bug? Am I mssing anything.. How to resolve this issue.


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

Post by chulett »

So you are calling the function from a C++ routine? The docs say that:

ReturnInfo is a pointer to a DSJOBINFO data structure where the requested information is stored. The DSJOBINFO data structure contains a union with an element for each of the possible return values from the call to DSGetJobInfo. For more information, see Data Structures.

Hope it helps somewhat. UCDI is our C Master, perhaps he can shine some light on this, worst case if no-one has the answer I'd suggest you open a support case.
Last edited by chulett on Tue Aug 22, 2017 3:00 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

unions in strict c++ cannot be accessed both ways. That is, if you assign x.field1 and try to read x.field2 it is "undefined". In practice, it works on every compiler I have every heard of or used, so long as you do not set the compiler options to extremely strict.

a union is just a block of bytes in memory where the size is big enough to hold the biggest thing in the union.

so you should be able to get to it via

something = ReturnInfo[0].fieldname; //whatever field you want

where something is the type of fieldname, be it a char* or a double or whatever else.

I can look at your code if you want.
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

again...

I haven't been able to resolve the issue with DSJ_JOBELAPSED. Can anyone let me know whats happening here.

DSJ_JOBELAPSED is a pointer to a character. char *jobElapsed;

The same routine works fine with DSJ_JOBNAME which is also a pointer to a char. char *jobName

partial code:

after defining DSPROJECT ProjectHandle and DSJOB JobHandle

char * ret;

DSGetJobInfo(JobHandle,DSJ_JOBELAPSED,ReturnInfo);
ret= (*ReturnInfo).info.jobElapsed;
return(ret);

I get the error when calling through a job

Tran,0: Operator terminated abnormally: received signal SIGSEGV
Tran,0: Fatal Error: ~APT_PMPlayer: terminating Player (node2, sequential APT_TransformOperatorImplV0S3_StrJobElapsed_Tran in Tran)
node_node2: Player 1 terminated unexpectedly.
main_program: APT_PMsectionLeader(2, node2), player 1 - Unexpected exit status 1.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: These was no reason to post this again as a new topic, so I deleted it. As a bonus, you get a free bump of this post.

Perhaps it's time to involve your support provider. Or post your complete code, as UCDI suggested.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply