Writing parameters to Hashed file
Posted: Tue Mar 07, 2006 5:06 pm
I have my parameters in a hashed file. The key is the paramName. In plaintext, it was in the format below-
paramName1=paramValue1
paramName2=paramValue2
and so on....
I have tried to use Kim's routine to assign parameters to my job. Following is the code:
I have used job parameters. My sequence has a number of jobs. How can I modify the above so that each job in the sequence has its parameters set. I have tried to change the code so that it behaves as a function that returns all the parameter names and values as a concatenated string. However, the next step would be to have a job that would parse the string and extract the param values that I could assign to the subsequent jobs. But, I don't know how that can be done. I know there are many solutions posted here, but I have only been successful when there is only a single parameter required in the entire sequence. Please show me some relatively simpler methods to do this.
THanks
paramName1=paramValue1
paramName2=paramValue2
and so on....
I have tried to use Kim's routine to assign parameters to my job. Following is the code:
Code: Select all
* ------------------------------------------------------------
* ParamFunc(JobName, WarnFlag, ParamFile)
$INCLUDE DSINCLUDE JOBCONTROL.H
Deffun DSRTimestamp Calling "DSR_TIMESTAMP"
* WarnFlag = @FALSE
* ------------------------------------------------------------
Ans = @FALSE
RoutineName = 'ParamFunc'
JobStartTime = DSRTimestamp()
JobHandle = DSAttachJob(JobName, DSJ.ERRFATAL)
* ------------------------------------------------------------
open ParamFile to ParamFilePtr else
Message = "Error: Unable to open hash file: " : ParamFile
Call DSLogInfo(Message, RoutineName)
goto TheEnd
end
* ------------------------------------------------------------
DsErrCode = DSPrepareJob(JobHandle)
RowLimit = 0
WarnLimit = 0
DsErrCode = DSSetJobLimit(JobHandle, DSJ.LIMITROWS, RowLimit)
DsErrCode = DSSetJobLimit(JobHandle, DSJ.LIMITWARN, WarnLimit)
ParamNameList = DSGetJobInfo(JobHandle, DSJ.ParamNameList)
ParamCount = Dcount(ParamNameList, ',')
For ParamNum = 1 To ParamCount
ParamName = field(ParamNameList, ",", ParamNum)
Read ParamValueRec From ParamFilePtr, ParamName Then
ParamValue = ParamValueRec<1>
Message = "Setting: " : ParamName :" = ": ParamValue
Call DSLogInfo(Message, RoutineName)
DsErrCode = DSSetParam(JobHandle, ParamName, ParamValue)
End
Next ParamNum
DsErrCode = DSRunJob(JobHandle, DSJ.RUNNORMAL)
DsErrCode = DSWaitForJob(JobHandle)
JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)
JobEndTime = DSRTimestamp()
Begin Case
Case JobStatus = DSJS.RUNFAILED
Message = "Job Failed: " : JobName
Call DSLogWarn(Message, RoutineName)
Case JobStatus = DSJS.RUNWARN and WarnFlag
Message = "Job had warnings: " : JobName
Call DSLogWarn(Message, RoutineName)
Case JobStatus = DSJS.RUNOK
Ans = @TRUE
End Case
THanks