ExecCommand in Sequences

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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

ExecCommand in Sequences

Post by chulett »

I'm just learning the joys of building Sequence jobs instead of writing my own batch code and have a question with regards to the ExecCommand stage.

I'm using it to execute a Korn shell script and was expecting it to capture any 'output' from the command into the job's log. However, in spite of the fact that the script echos out some status information as it runs, nothing of that makes it into the log. At the end of the 'executed' log entry, the line which says "Output from command ====>" has nothing after it.

Shouldn't it? It *looks* like it should work from examining the code the sequencer wrote, but it is a little cryptic to me:

Call DSExecute(x$type, x$cmd, x$output, x$56)
Call DSLogInfo(DSMakeMsg("DSTAGE_JSG_M_0007Executed: %1&LTL&GTReply=%2&LTL&GTOutput from command ====>&LTL&GT%3", x$cmd:@FM:x$56:@FM:Lower(x$output)), "@Stage_Name")

-craig

btw: DS 6.0.1 on HPUX 11
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Craig,

I too have recently been using the ExecCommand stage and have noticed a few things. If you are using parameters in the command or the parameters for the command then you will get this. As of right now (Verified by Ascential) the ExecCommand stage does not accept parameters. You can actually verify this yourself by looking at the sequencer code generated and see that there is no replacement of values prior to passing to DSExecute.

I was not even receiving a status back of failure or success.

Once I corrected this I was receiving information back to the log each time the stream was run.

Hope this helps,

Regards,

Michael Hester
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Interesting... First I find that I can't use a parameter for the recipient in the Email Notification stage and now this? I may just have to go back to rolling my own. [:)]

Actually, it looks to me like my parameters *are* being passed properly by the ExecCommand stage, but I could be wrong. At least it builds a string to pass to DSExecute and then uses that same string to call DSLogInfo and capture the status. In the DSLogInfo entry for 'Executed:', the parameters have been substituted correctly. However, I'll need to dig deeper to see if the command is actually executing correctly. [}:)]

Perhaps I'll hack the code out of the Sequence into a Batch and play around with it a little.

-craig

-craig
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Arrgh! [}:)] Running that code in a separate batch shows you are right, Michael. While it correctly subs parameters into the string it *logs*, the actual call to DSExecute gets the #parameters# untranslated. Not good.

So... in order to stay in the GUI, since this would work in a before/after job call to ExecSH, do I need to have a server job tacked into the Sequence that does nothing other than call the script? Sheesh.

Any suggestions on a work-around?

-craig
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

What you need to do is not use a command stage, but a job stage that runs a Batch:: job. Put your logic into the batch job to do whatever you want.



Kenneth Bland
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks. Thought about that one, too. My only 'issue' at this point is a pseudo-edict to stay out of batch coding and do everything in the GUI for the sake of the newbies.

Guess I'll need to make an exception for cases like this. [;)] Hopefully this kind of silly stuff will be fixed in the Twister release.

-craig
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Whence came this "pseudo-edict"? [?]
I was not aware of it. I've been suggesting to my clients to use the job sequence to prototype but to feel OK about customizing the code it produces.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No reason for you to be aware of it, Ray. [;)] It comes from the people I am currently working for. More of a 'preference' than a true edict, hence the 'pseudo'. They would just prefer that we stay in the GUI as much as possible and so I've actually be delving into the mysteries of Sequences, trying to get them to work for me. Unfortunately, some assumptions I made about where I could use parameters have proven to be false, so went looking for alternatives without falling totally back on writing my own Job Control.

-craig
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

Craig,

You're probably aware of this, but incase you're not...

I just noticed that I can use Job Parameters in different stages in a Job Sequencer, but I can't put pound signs ('#') around them...

ROOT_PATH : "/" : PROJECT_PATH: "/config_files/JobControl.cfg"

ROOT_PATH and PROJECT_PATH are job parameters.

I noticed in your post below ("...the actual call to DSExecute gets the #parameters# untranslated...") that you used pound signs. For some reason Ascential did it differently in the Job Sequences.

Hope this helps,
Tony
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hey Tony,

I'll try that when I get to work. I know that while most times you need the pound signs, some areas of usage do not. So far, normal parameter handling has worked fine in Sequences for running DataStage jobs. Parameters been problematic in the Email Notification and ExecCommand stages, however. I'll try it without the pound signs and see what happens.

-craig

Nope. Bottom line: Job parameters don't work as parameters to scripts run in the ExecCommand stage. At least not for me, this version, this o/s.
mhester
Participant
Posts: 622
Joined: Tue Mar 04, 2003 5:26 am
Location: Phoenix, AZ
Contact:

Post by mhester »

Craig,

Also, Ray makes mention that he tells his customers to directly edit the job control code, although I have not found a way to do that in my version (except to edit it via UV). It does not appear to be "editable" like Batch code. I don't think you would want too many fingers in the pot messing with sequencer code. Ray may know some flag or option or something that allows this?

Regards,

Michael Hester
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It can't be edited in the job sequence.
However, you can copy the code from there and paste it into the Job Control page of another server job's properties, and edit it there. That server job becomes your job control.

I also advocate placing an Annotation on the canvas in this case, advising future developers that this job comprises job control code but has no stages.

As to the "#" characters surrounding references to job parameters, it is documented somewhere (not least in the DS314Svr "DataStage Essentials" class) that this notation is relevant only in passive stages. You may already have noted that when you include a job parameter in an expression (via the Expression Editor) that it is not thus surrounded.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
Post Reply