Calling a Basic Routine With in Job Control
Moderators: chulett, rschirm, roy
Calling a Basic Routine With in Job Control
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
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
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Cut me some slack... recalled somewhat correctly and it was before 6AM local time.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.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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
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