The State
Allow an object to alter its behavior when its internal state changes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Enchantment // Job Control Wards
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
//STATE JOB (ACCT),'STATE PATTERN',CLASS=A,RESTART=STEP2
//* THE BEHAVIOR ALTERS BASED ON THE RESTART STATE
//STEP1 EXEC PGM=INITPGM
//*
//* IF WE RESTART AT STEP2, WE ASSUME STEP1'S STATE IS COMPLETE
//STEP2 EXEC PGM=PROCESS
//RECOVERY DD DSN=TEKROM.STATE.CHECKPOINT,DISP=SHR
//*
//STEP3 EXEC PGM=FINALIZE
The State
Mainframe batch jobs often process millions of transactions, demanding sophisticated state management. The State pattern is elegantly handled via checkpoint datasets and the RESTART= parameter. If a massive ritual is interrupted, the job’s internal state dictates its behavior upon resurrection. By setting RESTART=STEP2, the job bypasses initialization, reading its resumed state from a checkpoint file, inherently altering its execution flow based on prior completion.
Runic Tags:
#state
#jcl
#restart
#checkpoints