Page 1 of 1

Making an Execute Command stage produce a warning

Posted: Thu Dec 05, 2019 10:23 am
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.

Posted: Sat Dec 07, 2019 5:31 am
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:

Posted: Sat Dec 07, 2019 9:03 am
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.

Posted: Sun Dec 08, 2019 10:04 pm
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.

Posted: Mon Dec 09, 2019 9:33 am
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.

Posted: Mon Dec 09, 2019 5:35 pm
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.

Posted: Tue Dec 10, 2019 4:25 am
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.

Posted: Wed Dec 11, 2019 5:42 pm
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.

Posted: Mon Dec 30, 2019 11:46 am
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.