Subprocesses and calls

Updated: 2025-11-22

Subprocesses and calls in GPSS-Plus (introduction)

GPSS-Plus incorporates a complete subprocess system that did not exist in classic GPSS, thanks to the introduction of execution stacks.
This allows an entity —or even the system itself— to invoke independent procedures and resume execution in a controlled way.

There are several types of calls, depending on who invokes and who executes the procedure:

  • CALL — Executed by the same entity that invokes it.
  • SIGNAL — Executed by another entity, but only when the current one releases its turn.
  • SIGNALNOW — Executed by another entity immediately, interrupting the current one.
  • TIMEOUT — Executed by a virtual entity (VE) at a future time.
  • ON_* — Executed by a VE when an event occurs on a resource (SEIZE, RELEASE, ENTER...).
  • TIMER — Executed by a VE periodically.
  • PRE_RUN — Executed by a VE at the start of the simulation.

All of them jump to a PROCEDURE block, which must end with ENDPROCEDURE.

Hierarchical names

Procedures can be organized as paths:

agente.abrir
cliente.saludar
robot1.motor.arrancar

The returned value will be automatically stored in a variable whose name matches the last fragment ("abrir", "saludar", "arrancar").

Parameters and available SNA

Inside a PROCEDURE, the received parameters can be accessed:

  • P$PARAM_A — evaluated value
  • V$PARAM_A — raw value (array, object, number, unevaluated string)

Procedure termination

A procedure can end with:

  • RETURN value — Returns to the caller.
  • RETURN_RESTORE value — For SIGNAL/SIGNALNOW: the target entity resumes exactly where it was.
  • RETURN_RETRY value — For SIGNAL/SIGNALNOW: the target entity repeats its current step (typical in resource retries).