Simulating an error

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Simulating an error

Post by splayer »

I have a sequencer and I would like to simulate the raising of an error. That is, I would like to use a sequencer which would abort half way through so that I can restart from that point. I would assume that I could use DSLogFatal in a after-job routine. Based on a job status or user status parameter, when I retstart, the same after-job subroutine would not be executed. I would think that this is a common requirement for debugging error handling.

Any ideas would be appreciated.
dwblore
Charter Member
Charter Member
Posts: 40
Joined: Tue Mar 28, 2006 12:02 am

Post by dwblore »

Hello!

Well, you 'could' test the concept of restartability with the logic you've thought of.

When you run the sequence for the first time with lets say jobX having the after job subroutine, all jobs upto JobX would execute successfully.
JobX would abort and cause the sequence to be aborted too and would put it in the aborted/restartable state.

Now when you would rerun the entire sequence without compiling it etc ... it would skip all jobs/sequences upto JobX and then try and run JobX after reseting it- since it was in an aborted state previosuly.
Considering your after stage subroutine would still be there ... it would abort again.

However you would be able to verify the point of restart through your director log.


BTW - if you are using After/Before job subroutine merely harciding the return value to be non zero would cause the job to abort. you dont need to explicitly make a call to DSAbortToLog.

There are simpler ways of testing it out depending on what kind of jobs you have . I would for instance rename a source file a job would be expecting on the unix box so that the job may abort . Rename the file back to its original name and rerun the sequence ...

Make sure you have chosen
>Add checkpoints so sequence is restartable , and if necessary the
>Automatically handle jobs that fail
in the properties dialog for the sequences.

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

Post by ray.wurlod »

You've probably already noticed that job sequences do not support before/after subroutines. You will need to use Routine activities within the job sequence itself - the routines themselves will need to be created as transform functions, though these can be interludes to the requisite before/after subroutines.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

ray and dwblore, thank you for your responses.

ray, when you say that job sequences do not support before/after sub routines, I guess you mean that, job sequences with Job Activity stages with jobs which have before/after sub routines, will not work, right?

Can you explain what you mean by "transform functions"? Does that mean that they have to be developed in C for PX jobs?

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

Post by ray.wurlod »

Transform functions are developed in DataStage BASIC (as "server routines" whose type is "transform function"). They can be called from Routine activities in job sequences.

Job activities can (and do) successfully execute jobs where those jobs have before/after subroutines. What I said was that you do not find before/after subroutines called directly by job sequences.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

So just to clarify, we have the following types of routines in PX:

1)Custom routines:
a)Could be user defined
b)CANNOT be DS provided.

The code has to be developed in C/C++ and called from DS. These CAN be called using the Routine Activity stage in a job sequencer.

2)Transform functions:
a)Could be user defined
b)Could be DS provided
These are functions that primarily do some kind of transformation on data. These CAN be called using the Routine Activity stage in a job sequencer.

3)Before/After subroutines:
a)Could be user defined
b)Could be DS provided
These are generic routines that can be called before a job or after a job in a Job Activity stage in a job sequencer. However, they CANNOT be called using the Routine Activity stage in a job sequencer.

(There are 2 other types of routines, Custom Universe Functions and ActiveX functions, but I am not going to bother with them at this time. )

I would appreciate it if you could let me know if my assessment is correct?

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

Post by ray.wurlod »

1(b) - actually they could be DS provided, they just aren't.

There is example code provided elsewhere in the product. The reason is that you have to create, compile and link the C++ routine externally to DataStage; what goes in the Repository is only a description of the routine, not the routine itself.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

ray, in a transformer, we can only use PX custom routines, right? When I tried to use a routine as a value for a column, the only routines pulled up were parallel routines.
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Post by thebird »

In a Parallel Transformer, only a C/C++ routine can be used.

If you need to use a BASIC routine - you will have to pull in the BASIC transformer instead of the Parallel one. You can also use these in the After/Before job subroutines, as well as in the Routine Activity in the Job Sequence.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

How do I pick a BASIC transformer? I am using 7.5.1.A. I have gone through the posts in this forum. Also, in my pallette, the only transformer I see is the parallel transformer.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Musta missed this one. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

Craig, thank you for your response. I went to the post. These are the steps mentioned:

In the designer:

1. right mouse click on the Pallette text at the top of the pallette box
2. choose "customize Pallette"
3. In the top-left Repository window, select Parallel -> Processing -> Basic Transformer
4. after activating, click on the right arrow to add it to your pallette.

After Setp 2, I see a pallette with 3 things:
Respository Items (top left), Current Pallette groups and shortcut items(right), Default Pallette groups and shortcut items (bottom left)

Nowhere I see Parallel -> Processing -> Basic Transformer.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

In the repository items you will be able to see stage types just explore it and you will find it.

Thanks
Sam
Post Reply