Using DSGetJobInfo

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

priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Using DSGetJobInfo

Post by priyadarshikunal »

Actually I am new to datastage routines
i want to generate job start time stamp, job last timestamp and job status

for job start time stamp i used DS Macro "DSJobStartTimestamp"

but unable to find any macro or inbuilt function.

I think I should use "DSGetJobInfo"

I am good in C++ programming but dont know how to start?

i went through Parallel Job Advanced developer guide.

there i found functions its syntax and all,

but unable to find any sample code to define structure of a routine;

please post a sample code that defines the structure

i searched the posts of this site but that mainly describes only functions
used in DataStage Routine

thanks in advance
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Using DSGetJobInfo

Post by sachin1 »

you can use

DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP)

need little formating. (server job)
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: Using DSGetJobInfo

Post by priyadarshikunal »

sachin1 wrote:you can use

DSGetJobInfo(JobHandle,DSJ.JOBSTARTTIMESTAMP)

need little formating. (server job)
i have used this in server job but parellel implementation is different i wanted to know parellel implementation
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What about page 144 of the Advanced Programmer's Guide?
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

ArndW wrote:What about page 144 of the Advanced Programmer's Guide? ...
Actually that defines the syntax of "DSGetJobInfo" i know all functions but dont know how to use those in parallel routines
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I'm afraid I currently don't have any examples of this to give to you, but perhaps someone else here might wish to post code.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

ArndW wrote:I'm afraid I currently don't have any examples of this to give to you, but perhaps someone else here might wish to post code. ...
thanks for reply ArndW.

please post the code is you find one!

regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
ThilSe
Participant
Posts: 80
Joined: Thu Jun 09, 2005 7:45 am

Post by ThilSe »

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
$INCLUDE DSINCLUDE DSJ_XFUNCS.H
ErrorCode = 0 ;* set this to non-zero to stop the stage/job 

DIJobHandle = DSJ.ME *--- Get job handle
DIJobName = DSGetJobInfo(DIJobHandle, DSJ.JOBNAME) *--- Get job name
DIJobStartTs = DSGetJobInfo(DIJobHandle,DSJ.JOBSTARTTIMESTAMP)
*--- The variable DiJobStartTs has the time stamp in it. 

Paste the above code in a routine. Add code for getting end time stamp and status. Now the next steps depend on what you need to do with the values
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

ThilSe - that doesn't look like C++ code to me :shock:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Obfuscation? Maybe there are lots of #define statements literally changing the syntax to make it look like BASIC? You can do the same in BASIC with EQU LIT.
:lol:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

ray.wurlod wrote:Obfuscation? Maybe there are lots of #define statements literally changing the syntax to make it look like BASIC? You can do the same in BASIC with EQU LIT.
:lol:
ok, now I tried to make 1 Parellel Routine

but i am not able to bring it in runnable state

the code is as follows:

Code: Select all


#include "C:\Ascential\DataStage\Dsdk\include\dsapi.h"

long int GetRowCount(char* ProjectName,char* JobName,char* StageName,char* LinkName)
{
	DSLINKINFO *ReturnInfo=new DSLINKINFO;
	long int rowcount;
	DSPROJECT ProjectHandle=DSOpenProject(ProjectName);
	DSJOB JobHandle=DSOpenJob(ProjectHandle,JobName);
	rowcount=DSGetLinkInfo(JobHandle,StageName,LinkName,DSJ_LINKROWCOUNT,ReturnInfo);
	return(rowcount);
}

I compiled it
to get GetRowCount.obj

entries in datastage parellel routine window

routine name->GetRowCount
Type->External Function
Object Type->Object
External Subroutine Name->GetRowCount
Return Type->long
Library Path->c:\GetRowCount.obj

then I placed the routine in transformer with its arguments

but when i am trying to compile that job I am geeting an error

the error is as follows:

Output from transformer compilation follows:

##I TFCN 000001 15:17:29(000) <main_program>
Ascential DataStage(tm) Enterprise Edition 7.5
Copyright (c) 2004, 1997-2004 Ascential Software Corporation.
All Rights Reserved


##I TOSH 000002 15:17:29(001) <main_program> orchgeneral: loaded
##I TOSH 000002 15:17:29(002) <main_program> orchsort: loaded
##I TOSH 000002 15:17:29(003) <main_program> orchstats: loaded
##W TFPA 000012 15:17:29(006) <main_program> Warning: the PWD environment variable is not defined. Remote process startup may be unsuccessful as a result.If your ORCHESTRATE job does not start up correctly, please set your PWD variable to a value that will work on all nodes of your system.
##E TBLD 000000 15:17:35(000) <main_program> Error when checking composite operator: Subprocess command failed with exit status 40192
##E TFSR 000019 15:17:35(001) <main_program> Could not check all operators because of previous error(s)
##W TFCP 000000 15:17:35(002) <transform> Error when checking composite operator: The number of reject datasets "0"is less than the number of input datasets "1".
##I TBLD 000000 15:17:35(003) <main_program> Error when checking composite operator: Output from subprocess: C:\Ascential\DataStage\Projects\TCS\RT_BP40.O\V0S5_test_Transformer_5.C(240) : warning C4244: '=' : conversion from 'APT_Int64' to 'int', possible loss of data

##I TFCP 000008 15:17:35(004) <transform> Error when checking composite operator: cxx -LC:/Ascential/DataStage/Projects/TCS/RT_BP40.O/ -LC:/Ascential/DataStage/PXEngine/lib -LC:/Ascential/DataStage/PXEngine/user_lib -W/TP -W/dll -W/base:0x50000000 -lliborchnt -lliborchcorent -lliborchbuildopnt C:\GetRowCount.obj.o C:/Ascential/DataStage/Projects/TCS/RT_BP40.O/V0S5_test_Transformer_5.tmp.o -o C:/Ascential/DataStage/Projects/TCS/RT_BP40.O/V0S5_test_Transformer_5.dll
##I TBLD 000000 15:17:35(005) <main_program> Error when checking composite operator: Output from subprocess: LINK : warning LNK4224: /DEBUGTYPE:BOTH is no longer supported; ignored
LINK : fatal error LNK1181: cannot open input file 'C:GetRowCount.obj.o'

##E TCOS 000029 15:17:35(006) <main_program> Creation of step finished with status = FAILED (test.Transformer_5)

*** Internal Generated Transformer Code follows:
0001: //
0002: // Generated file to implement the V0S5_test_Transformer_5 transform operator.
0003: //
0004:
0005: // define external functions used
0006: extern int64 GetRowCount(string ProjectName,string JobName,string StageName,string LinkName);
0007:
0008: // define our input/output link names
0009: inputname 0 DSLink6;
0010: outputname 0 DSLink9;
0011:
0012: initialize {
0013: // define our row rejected variable
0014: int8 RowRejected0;
0015:
0016: // define our null set variable
0017: int8 NullSetVar0;
0018:
0019: // declare our intermediate variables for this section
0020: string InterVar0_0;
0021: string InterVar0_1;
0022: string InterVar0_2;
0023: string InterVar0_3;
0024:
0025: // initialise constant values which require conversion
0026: InterVar0_0 = "TCS";
0027: InterVar0_1 = "test";
0028: InterVar0_2 = "Row_Generator_0";
0029: InterVar0_3 = "DSLink3";
0030: }
0031:
0032: mainloop {
0033: // initialise our row rejected variable
0034: RowRejected0 = 1;
0035:
0036: // evaluate columns (no constraints) for link: DSLink9
0037: DSLink9.Rowcount = GetRowCount(InterVar0_0 , InterVar0_1 , InterVar0_2 , InterVar0_3);
0038: writerecord 0;
0039: RowRejected0 = 0;
0040: }
0041:
0042: finish {
0043: }
0044:
*** End of Internal Generated Transformer Code

Can any one tell me where i went wrong
or what are the other things i should do to make the routine runnable



thanks in advance
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

WHERE are you proposing to use this function?

If you need the row count inside a Transformer stage it's already exposed through system variables.

If you don't need it until the job has processed all rows, then you can use DSGetJobInfo() - or the macros that you discovered - in an after-job subroutine. Even in parallel jobs these use the DataStage BASIC language.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

ray.wurlod wrote:WHERE are you proposing to use this function?

If you need the row count inside a Transformer stage it's already exposed through system variables.

If you don't need it until the job has processed all rows, then you can use DSGetJobInfo() - or the macros that you discovered - in an after-job subroutine. Even in parallel jobs these use the DataStage BASIC language.
I know that but i just curious to know "how to implement a parallel routine"
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Pavan_Yelugula
Premium Member
Premium Member
Posts: 133
Joined: Tue Nov 23, 2004 11:24 pm
Location: India

Post by Pavan_Yelugula »

Hi
Just like Ray Pointed out if you want DSGetJobInfo()-you can use an AfterJob subrotuine which still uses an BASIC for what ever functionality u want to use it for...
If you need a tutorial on how to write parallel Routines...check this blog by vincent...
http://blogs.ittoolbox.com/bi/websphere ... ials-15526

You need to register on IBM Site but you have a wonderful tutorial there for creating a parallel routine...

Thanks
Pavan
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Pavan_Yelugula wrote:Hi
Just like Ray Pointed out if you want DSGetJobInfo()-you can use an AfterJob subrotuine which still uses an BASIC for what ever functionality u want to use it for...
If you need a tutorial on how to write parallel Routines...check this blog by vincent...
http://blogs.ittoolbox.com/bi/websphere ... ials-15526

You need to register on IBM Site but you have a wonderful tutorial there for creating a parallel routine...

Thanks
Pavan
Went through those blogs, they are descriptive but didn't really got help on this topic

Ray, I was trying to use these routines as before/after subroutine, Transform function or in a sequence but i wanted to know how to implement a parallel routine thats all :?:
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply