Making an Execute Command stage produce a warning

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Making an Execute Command stage produce a warning

Post by abc123 »

I have an Execute Command stage that does a:

cat filename

There is a Job Activity stage before it in the sequence job which produces a file. I would like the Execute Command stage to produce a warning at run-time. I know that I can do an After-Job Subroutine in the job in the Job Activity stage and do an ExecSh and remove the file but I want to do it at run-time without changing existing code.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry but you're going to need to clarify this. Produce a warning? When, under what circumstances? And please clarify what that has to do with your "remove the file" remark. Rather than give an unrelated answer, I'd rather make sure we're answering the right question. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Craig, thank you for your response.

1)
I have a sequence job design like this:

JobActivity1--->ExecuteCommand ---> JobActivity2
| |
~ ~
TerminatoryActivity1 TerminatoryActivity2

JobActivity1 produces a flat file. I would like to raise a warning in the ExecuteCommand stage so that execution moves to the TerminatorActivity stage. So JobActivity1 will execute successfully without a warning.

2)
I am also trying to raise a warning in the DataStage job that is called by the JobActivity1 stage but have failed so far. I can do it by stopping the job monitor but I was hoping to do it through some other way.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: Please edit your response and wrap your sequence example in code tags so the whitespace is preserved and we can see what's where properly. You will need to lather-rinse-repeat with the preview button and tweak until it all lines up properly. It won't look correct until you preview, btw.
-craig

"You can never have too many knives" -- Logan Nine Fingers
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Craig, thank you for your response.

1)
I have a sequence job design like this:

Code: Select all

JobActivity1--------->ExecuteCommand---------> JobActivity2
     |                      |
     ~                      ~
TerminatoryActivity1 TerminatoryActivity2
NOTE: I had to use a caret to show the arrow pointer.

JobActivity1 produces a flat file. I would like to raise a warning in the ExecuteCommand stage so that execution moves to the TerminatorActivity2 stage. So JobActivity1 will execute successfully without a warning.

2)
I am also trying to raise a warning in the DataStage job that is called by the JobActivity1 stage but have failed so far. I can do it by stopping the job monitor but I was hoping to do it through some other way.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Add an invalid command to the pipeline in the Execute Command activity.

For example, if you have cat myfile as the command, change it to cat myfile ; test -f nonexistentfile

The test command will have a non-zero exit status, which will cause a condition that can be captured by a Failure (or even Otherwise) trigger in the Execute Command activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

Ray, thank you very much for your response.

I want to do it without making any code change on the ExecuteCommand stage. This is because, I want to test my error handler on the ExecuteCommand stage just like it would happen in production. I can delete the file in the JobActivity stage before the ExecuteCommand stage but once again that is changing code.

I was wondering if there was a way to mimic an error on the ExecuteCommand stage at run-time. Looks like there isn't.

Would it be possible to do it in a DataStage job? I tried putting a string in a number column but Oracle wouldn't allow it. I can stop the job monitor and produce a warning in the job in the job activity stage but I was trying to see if there was some other way.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Short answer - no.

It might be an interesting thing to have in a test suite, such as the continuous integration (DevOps) capabilities of MettleCI but, as far as I am aware, there's nothing in Sequence jobs as they stand that allow you to trigger warnings when there's no reason to.

Actually you can, but it's a major hack. Go to the Job Control tab of Job Properties and copy all of the code that's there. Then create a server job and paste the code into its Job Control tab. Then modify that code to your heart's content; unmodified it will have the same functionality as the original generated code.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
UCDI
Premium Member
Premium Member
Posts: 383
Joined: Mon Mar 21, 2016 2:00 pm

Post by UCDI »

you can also use the (? logwarn ?) datastage capability to throw a warning on the log after the run command stage, using its output or whatever to (bypass or trigger?) the warning. This may be what you said you didn't want.
Post Reply