Assigning the output of DSExecute command to job Parameter

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
ramkumar
Participant
Posts: 2
Joined: Wed Jan 11, 2006 8:21 am

Assigning the output of DSExecute command to job Parameter

Post 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
adarsh shrinagesh
Premium Member
Premium Member
Posts: 68
Joined: Sat Feb 05, 2005 4:59 am
Location: India

Post 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.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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.
ramkumar
Participant
Posts: 2
Joined: Wed Jan 11, 2006 8:21 am

The error is cleared thanks

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply