Page 1 of 1

Assigning the output of DSExecute command to job Parameter

Posted: Tue Jan 17, 2006 7:25 am
by ramkumar
Call DSExecute("NT","D:\cygwin\bin\bash.exe --login -c '/cygdrive/d/Ram/script/CheckFile.sh NXRP_CBD'", Output, SystemReturnCode)
The script returns the filename which starts with 'NXRP_CBD'

How to assign the 'Output' to the job parameter.

I tried this code. But this did not work

ErrCode = DSSetParam(hJob1, "SOURCE_FILE_NAME",Output)
But when i printed the Output to log it shows the filename correctly. but it did not set the parameter

When i tried the same thing in a job sequence, the following error message came in the log

Ctrl_Job..JobControl (@Execute_Command_4): Executed: D:\cygwin\bin\bash.exe --login -c '/cygdrive/d/Ram/script/CheckFile.sh NXRP_CBD'
Reply=0
Output from command ====>
NXRP_CBD_AVL_DTL.txt

Ctrl_Job..JobControl (@Job_Activity_1): Controller problem: Error calling DSSetParam($SOURCE_FILE_NAME), code=-4
[ParamValue/Limitvalue is not appropriate]

Please help me solve this

Posted: Tue Jan 17, 2006 2:44 pm
by adarsh shrinagesh
ErrCode = DSSetParam(hJob1, "SOURCE_FILE_NAME",Output)

First things first - are you trying to set the value of the parameter for "this" job itself.
If you're setting the parameter of a job that u wud be calling then ur code looks fine ...
U cant set the parameter for the calling job from its Job control.

Posted: Tue Jan 17, 2006 5:02 pm
by vmcburney
I recommend you make a routine that returns the value and call it from a sequence job via the UserVariables activity stage. It can then be passed as a job parameter into any job joined via a path of links to the UserVariables stage.

The error is cleared thanks

Posted: Mon Jan 30, 2006 5:01 am
by ramkumar
The actual problem is the output is delimited with the @FM character. so i replaced that character with null. then it worked fine

DSSetParam("SOURCE_FILE_NAME",convert(char(254),"",Output));

Thanks

Posted: Mon Jan 30, 2006 4:47 pm
by ray.wurlod
No you didn't. You replaced it with a zero-length string. This is not the same as null.

Null is "unknown". To replace with null you would have used the system variable @NULL, and rendered your result unusable.