VBScript return value to Datastage

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
dylsing
Participant
Posts: 35
Joined: Thu May 04, 2006 9:56 pm

VBScript return value to Datastage

Post by dylsing »

Hi,

I wrote a VBScript to manage some files. I need my VBScript to return a value for my Command Prompt stage to capture it if no files can exist.

Later in a Sequence, I will extract the value from the job to decide whether to run the subsequent jobs.

I am not that familiar with how Datastage handles VBScript.
1) How do I write this return value statement in VBScript, is it like like returning a value in the function but I do in in the Main()? Presently I am using Wscript.Quit(valuetoReturn).
2) And what Datastage job can capture this value that is returned and output the value in the job, so that I can conditionally trigger other jobs?

I hope this is clear. Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There's no such thing as a Command Prompt stage. Do you mean a Command stage in a job design, or an Execute Command activity in a job sequence.

The mechanism for the latter is to use the activity variable ActivityName.$ReturnValue

With a Command stage - which is executed for every row processed - you simply write the output of the command into a column on the output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dylsing
Participant
Posts: 35
Joined: Thu May 04, 2006 9:56 pm

Post by dylsing »

Oops, I mean Command Stage. I am too used to the word Command Prompt.

Am I able to retrieve the value that VBScript returns when I activate it in the Command Stage?
dylsing
Participant
Posts: 35
Joined: Thu May 04, 2006 9:56 pm

Post by dylsing »

1) I have managed to save the returned value, using the Command Stage, to a flat file but what I really need is to throw this value up as a job output.

2) I have been playing with the ExecCommand activity, and though I managed to run my vbscript, and even succeeded in reading my return value (which I chose to be -888) in the log, it doesn't allow me to output it as a condition check. I get the error below:
14:58:03: Execute_Command_26 finished, reply=-888
14:58:03: Exception raised: @Execute_Command_26, Unhandled failure (-888) encountered executing command cscript /nologo E:\Test\test.vbs "E:\Test\" "E:\Test\TempOutput.txt"
14:58:03: Sequence failed (restartable)
The script ran perfectly and I was expecting the -888 value but it records it as an error which I know it's not.
Would anyone know how I can avoid this and capture this value? By the way, I am using WScript.Quit() to return these values.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Turn off 'Automatically handle activities that fail' - a routine that does not return zero is considered to have failed. It's in the help.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Change the trigger to a custom trigger. Instead of testing for 0 (OK trigger) a custom trigger can be any legal expression.
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