⚔️ RPG WARD DIFFICULTY: Apprentice Creational

Builder: Forging the Mainframe Construct

Step-by-step assembly of complex Business Logic Runes on the IBM iSeries.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Transmutation // Artifice
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// RPG PATTERN //
**FREE
Ctl-Opt NoMain;

Dcl-Ds Golem_t Qualified Template;
  Head Char(20);
  Body Char(20);
  Core Char(20);
End-Ds;

Dcl-Proc Builder_Init Export;
  Dcl-Pi *N Pointer;
  End-Pi;
  Dcl-S pGolem Pointer;
  pGolem = %Alloc(%Size(Golem_t));
  Return pGolem;
End-Proc;

Dcl-Proc Builder_SetCore Export;
  Dcl-Pi *N;
    pGolem Pointer Value;
    coreType Char(20) Const;
  End-Pi;
  Dcl-Ds Golem Likeds(Golem_t) Based(pGolem);
  Golem.Core = coreType;
End-Proc;

Builder

The Builder pattern separates the incantation of a complex ward from its final representation. On the iSeries, this translates to incrementally populating a dynamic Data Structure before unleashing its logic across the DB2 files.

Runic Tags: #creational #ibm-i #runes #builder