Calling a Basic Routine With in Job Control

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

saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Calling a Basic Routine With in Job Control

Post by saikir »

Hi All,

I am trying to call a user defined basic routine with in the job Control. I have tried to prefix the Routine with "DSU." while calling but still get the error "Never Dimensioned". From the error i understand that Job Control is not able to recognize the user defined routine. Is there anyway where in i can call the user defined routine with in the job control?

Regards,
Sai
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Did you search?

This has been discussed loads of times.
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi,

I did search the forum and one of the suggestions was to prefix "DSU" which did not help.

Regards,
Sai
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi,

Tried to call the routine with prefixing DSU in quotes. and is working fine. HAs gone through a sequner job to see how the routines are being called.

Ex 'DSU.RouTineName'(Arg1);

Regards,
Sai
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What type of server routine? The method is different depending on whether it's a transform function or a before/after subroutine.

For transform functions you need a DEFFUN declaration.

For before/after subroutines, which are called with CALL statement, you need to add the "DSU." prefix.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi Ray,

I am traying to call a basic routine "Rep" which is a transform function. I am not able to call it by prefixing DSU. Can you please let me know how to achieve this?

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

Post by chulett »

'Not able to' why? From what I recall they are catalogued in upper-case, see if DSU.REP works in the DEFFUN statement.
-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 »

You recall incorrectly. Upper-case cataloging only applies to the routines supplied with DataStage, such as the SDK routines. User-written routines have case-sensitive Catalog names, with "DSU." as their prefix.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Show us what you are doing (the actual code, surrounded by Code tags).

You can not CALL a transform function.

You must declare it with a DEFFUN declaration, and then use it as a function in your code.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: please move to Server forum
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 »

:cry:
ray.wurlod wrote:You recall incorrectly. Upper-case cataloging only applies to the routines supplied with DataStage, such as the SDK routines. User-written routines have case-sensitive Catalog names, with "DSU." as their prefix.
Cut me some slack... recalled somewhat correctly and it was before 6AM local time. :wink:
-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 »

No sympathy. Dennis makes me present webinars at 6AM local time (which means being on-line by 5:30AM).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi Ray,

The requirement is like this. I will have to capture the rows per second for all the stages in a job and write it to a file.

I am trying to achieve this in a job control where i will accept the job name and get stages corresponding to the job and store them in a file. After this i am trying to get all the links for the stages to a file. Once i get all the stages and links in a file, i will loop through the file and write the rows per second to a file in the following format:

Job Name Stage Name RowsPerSecond.


I am trying to capture stages in a job using the following function "Rep"


$INCLUDE DSINCLUDE JOBCONTROL.H

DHandle=0 ;
hJob1=DSAttachJob(Arg1,DSJ.ERRWARN) ;
Ans=DSGetJobInfo(hJob1,DSJ.FULLSTAGELIST) ;
Ans=Ereplace(Ans,',',Char(13):Char(10),0) ;
DHandle=DSDetachJob(hJob1) ;
Reply=Ans ;


Since DSGetJobInfo will give the stage list coma separated i am using Ereplace to replace the coma with New line so that i can loop through the file line by line.

Code of the Job Control:

$INCLUDE DSINCLUDE DSJ_XFUNCS.H

Call DSLogInfo(JobName,"Job Control") ;
Call DSLogInfo(StageName,"Job Control") ;
Call DSLogInfo(LinkName,"Job Control") ;

ElapsedTime=0 ;
RowsSec=0 ;
StageList=0 ;


StageList=DSU.Rep(JobName)
Call DSLogInfo(StageList,"Job Control") ;

stgListFileName=FilePath : "/" : JobName : "." : "StageList.dat"

*---- Opening the File

OpenSeq stgListFileName To objFileVar1
Else
Create objFileVar1
Else
ErrorCode = 1
WeofSeq objFileVar1
End
End
WeofSeq objFileVar1

stgListRecord = StageList

WriteSeq stgListRecord To objFileVar1 Then
End

hJob1 = DSAttachJob(JobName, DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: JobName", "JobControl")
Abort
End

ElapsedTime=DSGetStageInfo(hJob1,StageName,DSJ.STAGEELAPSED) ;
Call DSLogInfo(ElapsedTime, "Job Control") ;

RowsSec=DSGetLinkInfo(hJob1,StageName,LinkName,DSJ.LINKROWCOUNT)/ElapsedTime ;
Call DSLogInfo(RowsSec, "Job Control") ;

Reply=RowsSec

strFileName=FilePath : "/" : JobName : ".dat"

Call DSLogInfo(strFileName, "Job Control") ;


*---- Opening the File

OpenSeq strFileName To objFileVar2
Else
Create objFileVar2
Else
ErrorCode = 1
WeofSeq objFileVar2
End
End
WeofSeq objFileVar2

strRecord = JobName : " " : StageName : " " : RowsSec

WriteSeq strRecord To objFileVar2 Then
End

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

Post by chulett »

And? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
saikir
Participant
Posts: 92
Joined: Wed Nov 08, 2006 12:25 am
Location: Minneapolis
Contact:

Post by saikir »

Hi,

I am not able to call the routine "Rep" which is a transform function in my job control. I get an error Rep never dimensioned which is because "Rep" is not getting recognized as a routine. Want to know how to call "Rep" in my job control.

Hope i am clear.

Regards,
Sai
Post Reply