Job cntroller is not sending the parameter to attached job

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Job cntroller is not sending the parameter to attached job

Post by sushanth »

Hello
Dear members
I'm facing the problem like... I have the job controller which calls the attached Job,the controller has to take the file name from Unix dynamically and pass the same to the job as a parameter, but it passes all parameters except the file name,can you help ?
the following is the code written in the job controller...

it is throughing error code as -4

if isnull(DateSuffix) or trim(DateSuffix) = '' or DateSuffix = 'AUTO' then

! first work out date part for today

DatePart = trim(oconv((date()-1) , 'D-YMD[4,2,2]'),'-','A')

end else

DatePart = DateSuffix

end



for i=1 to 10


SRC = src_sys(i)

Call DSLogInfo(' SRC = ': SRC,"this" )

cmd = 'cd ':REPORTS_DIR:'; ls ': CNTRY_CODE:'_':SRC:'_':DatePart:'*'

CNTRY_CODE:'_':SRC:'_':DatePart:'.txt'


Call DSExecute('UNIX',cmd,msg,RetCode)

Call DSLogInfo(' RetCode = ': RetCode,"this" )

Call DSLogInfo(' Filaname = ': msg,"this" )


filename = msg

unzip = 'cd ':REPORTS_DIR:'; uncompress ': filename

Call DSExecute('UNIX',unzip ,msg,RetCode)

Length =Len(filename)

Call DSLogInfo(' Length = ': Length ,"this" )

sumFile1 = filename

Call DSLogInfo('File Name - ' : sumFile1, 'Test')


Call DSLogInfo(' sumFile1= ': sumFile1 ,"this" )

sumFile = CODE:'_ActiveActSummary_':DatePart:'.txt'

Call DSLogInfo(' sumFile = ': sumFile ,"this" )


* Setup CopyOfSeq_Load_database, run it, wait for it to finish, and test for success

hJob2 = DSAttachJob("CopyOfSeq_Load_database", DSJ.ERRFATAL)

If NOT(hJob2) Then

Call DSLogFatal("Job Attach Failed: CopyOfSeq_Load_database", "JobControl")

Abort

End

ErrCode = DSSetParam(hJob2, "Countrycode", CODE)

ErrCode = DSSetParam(hJob2, "DateSuffix", DateSuffix)

ErrCode = DSSetParam(hJob2, "SourceDirectory", REPORTS_DIR)

ErrCode = DSSetParam(hJob2, "UserID", "sa")

ErrCode = DSSetParam(hJob2, "SRC_APPLN_NAME", SRC_APPLN_NAME)

ErrCode = DSSetParam(hJob2, "SourcefileName_Summary", sumFile)



ErrCode = DSSetParam(hJob2, "SourcefileName_Details", sumFile1)
(it is not sending only this parameter to Attached Job)
Call DSLogInfo(' ErrCode = ': ErrCode ,"this" )



ErrCode = DSRunJob(hJob2, DSJ.RUNNORMAL)

ErrCode = DSWaitForJob(hJob2)

Status = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)

If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then

* Fatal Error - No Return

Call DSLogFatal("Job Failed: CopyOfSeq_Load_database", "JobControl")

End
Last edited by sushanth on Thu Jun 23, 2005 6:49 am, edited 3 times in total.
Sushanth
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

The DSSetParam line says
"FileNameX, "
whereas it must say
", FileNameX"
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

Sainath.Srinivasan wrote:The DSSetParam line says
"FileNameX, "
whereas it must say
", FileNameX"
Hi
Thanks but it will take string not as a variable
Sushanth
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

What I meant was that the comma symbol was in the right side of the variable.

It must say ParamName, value and not ParamName Value ,
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

It appears that you have edited your earlier post.

Even now, there is a defect in the line.

It currently says

Code: Select all

ErrCode = DSSetParam(hJob2, "SourcefileName_Details" FileNameX) 
cut must say

Code: Select all

ErrCode = DSSetParam(hJob2, "SourcefileName_Details"[b], [/b]FileNameX) 
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

[quote="Sainath.Srinivasan"]It appears that you have edited your earlier post.

Yah still we are getting the following error

LoadReportsControl..JobControl (this): ErrCode-4
Sushanth
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Did you include the change mentioned in my last post? Are you getting the error even then?
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

Sainath.Srinivasan wrote:Did you include the change mentioned in my last post? Are you getting the error even then?
Yes,
Sushanth
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Include a

Code: Select all

 Call DSLogInfo('File Name - ' : FileNameX, 'Test')
after the EReplace line and once just before the DSSetParam line.
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

Sainath.Srinivasan wrote:Include a

Code: Select all

 Call DSLogInfo('File Name - ' : FileNameX, 'Test')
after
the EReplace line and once just before the DSSetParam line.
Hello,
yah I have again edited the post and facing the same ....
Thanks
Sushanth
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Have you looked up what an error code of 4 means? It equates to DSJE.BADVALUE and means "Parameter Value is not appropriate for that parameter type".

So... what type do you have the parameter defined as and what value are you trying to set it to?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

chulett wrote:Have you looked up what an error code of 4 means? It equates to DSJE.BADVALUE and means "Parameter Value is not appropriate for that parameter type".

So... what type do you have the parameter defined as and what value are you trying to set it to?
We have set it as String and we expect it as string.
Thanks
Sushanth
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Doesn't matter what you 'expect' it to be, what is the exact value you are attempting to set it to when it fails? Write sumFile1 to your log file first so you know.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sushanth
Participant
Posts: 18
Joined: Sat Oct 09, 2004 10:13 am
Location: Malaysia
Contact:

Post by sushanth »

chulett wrote:Doesn't matter what you 'expect' it to be, what is the exact value you are attempting to set it to when it fails? Write sumFile1 to your log file first so you know.
Yah it is giving the value correct as
sumFile1= CODE_SRC_Datesuffix_I.txt in the log info
but the log in the attached job shows blank for sumFile1
then not found file ....
Sushanth
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, then at this point something about your assumptions is incorrect or it would be working... and we've done all we can to point you in the right direction. Double-check everything about that parameter and how you are setting it. Have someone else check, it's amazing what another pair of eyes will notice that you don't. :wink:
-craig

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