Replace the job which you would like to submit suspended by a job which does nothing but succeed (run program: 0) and define a BEFORE FINAL Trigger on SUCCESS on this job submitting a child which is supended.
So if the bach is skipped the trigger is not executed because the state of the triggering job will be SKIPPED and no suspended job will exist.
This is shown in Example 1 below.
An even better solution to your problem is to use a PENDING state for the job.
PENDING states a meant to reflect actions outside of the scheduling system (another scheduler, manual actions, ...)
A Job in state pending will be treated like a running job which has to get a final state by a set state command manually or programmatically using the API.
The Example 2 below shows such a job which is shown in blue while the reboot should be done.
After the reboot you don not 'resume' the job but do a 'set state' (the buttong with the red/green arrow) to SUCCESS to continue your batch.
This should solve your problem.
create or alter folder SYSTEM.'TRIGGER_SUSPENDED'
with
group = 'ADMIN',
environment = none,
inherit grants = (CREATE CONTENT, DROP, EDIT, MONITOR, OPERATE, SUBMIT, VIEW, RESOURCE),
parameters = none;
create or alter job definition SYSTEM.'TRIGGER_SUSPENDED'.'BEFORE_FINAL'
with
aging = none,
min priority = none,
children = none,
dependency mode = all,
environment = 'SERVER@LOCALHOST',
errlog = '${JOBID}.log' NOTRUNC,
group = 'ADMIN',
inherit grants = (DROP, EDIT, MONITOR, OPERATE, SUBMIT, VIEW, RESOURCE),
kill program = none,
logfile = '${JOBID}.log' NOTRUNC,
NOMASTER,
priority = 50,
parameters = none,
profile = 'STANDARD',
required = none,
rerun program = none,
resource = none,
runtime = 0,
runtime final = 0,
run program = '0',
NOSUSPEND,
type = JOB,
workdir = none;
create or alter job definition SYSTEM.'TRIGGER_SUSPENDED'.'TRIGGER_SUSPENDED'
with
aging = none,
min priority = none,
children = none,
dependency mode = all,
environment = 'SERVER@LOCALHOST',
errlog = '${JOBID}.log' NOTRUNC,
group = 'ADMIN',
inherit grants = (DROP, EDIT, MONITOR, OPERATE, SUBMIT, VIEW, RESOURCE),
kill program = none,
logfile = '${JOBID}.log' NOTRUNC,
MASTER,
priority = 50,
parameters = none,
profile = 'STANDARD',
required = none,
rerun program = none,
resource = none,
runtime = 0,
runtime final = 0,
run program = '0',
NOSUSPEND,
type = JOB,
workdir = none;
create or alter trigger 'BEFORE_FINAL' on job definition SYSTEM.'TRIGGER_SUSPENDED'.'TRIGGER_SUSPENDED'
with
active,
condition = none,
nomaster,
nowarn,
limit state = none,
suspend,
state = (
'SUCCESS'
),
submitcount = 1,
submit SYSTEM.'TRIGGER_SUSPENDED'.'BEFORE_FINAL',
type = BEFORE_FINAL;
Example 2:
create or alter exit state definition 'REBOOTING';
create or alter exit state mapping 'REBOOT' with map = ('REBOOTING');
create or alter exit state profile 'REBOOT'
with
default mapping = 'REBOOT',
states = (
'REBOOTING' pending,
'SUCCESS' final,
'SKIPPED' final unreachable
);
create or alter job definition SYSTEM.'REBOOT'
with
aging = none,
min priority = none,
children = none,
dependency mode = all,
environment = 'SERVER@LOCALHOST',
errlog = '${JOBID}.log' NOTRUNC,
group = 'ADMIN',
inherit grants = (DROP, EDIT, MONITOR, OPERATE, SUBMIT, VIEW, RESOURCE),
kill program = none,
logfile = '${JOBID}.log' NOTRUNC,
MASTER,
priority = 50,
parameters = none,
profile = 'REBOOT',
required = none,
rerun program = none,
resource = none,
runtime = 0,
runtime final = 0,
run program = '0',
NOSUSPEND,
type = JOB,
workdir = none;