Job cntroller is not sending the parameter to attached job
Moderators: chulett, rschirm, roy
Job cntroller is not sending the parameter to attached job
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
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
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
It appears that you have edited your earlier post.
Even now, there is a defect in the line.
It currently says
cut must say
Even now, there is a defect in the line.
It currently says
Code: Select all
ErrCode = DSSetParam(hJob2, "SourcefileName_Details" FileNameX)
Code: Select all
ErrCode = DSSetParam(hJob2, "SourcefileName_Details"[b], [/b]FileNameX)
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Include a
after the EReplace line and once just before the DSSetParam line.
Code: Select all
Call DSLogInfo('File Name - ' : FileNameX, 'Test')
Hello,Sainath.Srinivasan wrote:Include aafterCode: Select all
Call DSLogInfo('File Name - ' : FileNameX, 'Test')
the EReplace line and once just before the DSSetParam line.
yah I have again edited the post and facing the same ....
Thanks
Sushanth
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?
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
"You can never have too many knives" -- Logan Nine Fingers
We have set it as String and we expect it as string.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?
Thanks
Sushanth
Yah it is giving the value correct aschulett 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.
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
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers