Page 1 of 1

Detect restart

Posted: Fri Nov 28, 2014 11:19 am
by boxtoby
Hi,

Does anyone know how to detect if a sequence has been restarted?

I would like to redirect the processing in such an event.

Many thanks,
Bob.

Posted: Fri Nov 28, 2014 12:03 pm
by chulett
I for one would like a little more detail before diving into this. Can you clarify what you mean by "restarted"? I'm guessing you mean one with checkpointing that has aborted and then is restarted from the point of failure but would like that confirmed.

I'd also be curious what "redirect the processing" would mean, something you have no control over if you are using checkpoints.

Posted: Fri Nov 28, 2014 7:51 pm
by ray.wurlod
The log will tell you.

Posted: Sat Nov 29, 2014 1:41 am
by chulett
... after the fact. I think this is a "during the fact" question.

Posted: Sat Nov 29, 2014 2:30 am
by ArndW
Yes, you can detect whether a given run of a checkpointed sequence is happening after a restart. There are 2 DS routines which can be called to set and retrieve checkpoint information, I've used them in the past; unfortunately I'm now away from a DS installation where I can check what they are called. If you create a small sequence with just one stage and make it restartable and look at the generated source code (in the Designer job control) you can easily find the call that checks for existence of a checkpoint and build that into your sequence manually.

Posted: Mon Dec 01, 2014 11:32 am
by boxtoby
Hi,

Thanks for the suggestion of looking in the Sequence code in the job header. I found the routine "DSCheckPointExists" and created the routine below.

However, the routine when called from the sequence always returns "START" whether running from normal or restart. As far as I can tell the function is always returning zero.

Can you see what I am doing wrong?

Code: Select all

$include DSINCLUDE DSJ_XFUNCS.H

      If DSCheckPointExists(DSJ.ME, cp$dtm) Then
         Ans = "RESTART"
      End
      Else
         Ans = "START"
      End
Many thanks,
Bob.

Posted: Mon Dec 01, 2014 2:49 pm
by chulett
You would need to supply a value for cp$dtm otherwise it will always take the false path. It is looking for the existence of a specific "checkpoint datetime" to validate.