Chapter 2 Key Takeaways: Virtual Storage Architecture

Threshold Concept

Address space isolation via DAT: Every address space has its own page tables. The same virtual address in two address spaces maps to different real storage. z/OS switches page tables (via control register 1) when dispatching tasks in different address spaces. This hardware mechanism is the foundation of z/OS security and stability.


The Three Address Boundaries

Boundary Address Bits Name Significance
Line 16 MB 24 Below/above the line Legacy MVS/370 limit; mostly historical
Bar 2 GB 31 Below/above the bar Critical — where most COBOL lives; hard hardware limit for AMODE 31
Theoretical max 16 EB 64 Above the bar LP(64) territory; controlled by MEMLIMIT

Below-the-Bar Address Space Layout

2 GB ─────────────── THE BAR ────────────────
 │  Extended User Region         (~1,640 MB usable)
 │    ├── Your working storage
 │    ├── LE heap + stack
 │    ├── File buffers (VSAM, QSAM)
 │    ├── DB2 thread storage
 │    ├── Load module
 │    └── LE runtime libraries
 │  Extended LSQA/SWA            (~15-30 MB)
 │  Extended SQA                 (~50-150 MB)
 │  Extended CSA                 (~200-600 MB)
16 MB ────────────── THE LINE ───────────────
 │  Below-line areas (nucleus, CSA, SQA, user)
0 ──────────────────────────────────────────

Key insight: ~400 MB is consumed by system areas before your program gets a single byte. Your usable space below the bar is approximately 1.6 GB, not 2 GB.


The Storage Abend Quick Reference

Code Name Scope Root Cause First Response
S80A Out of virtual storage Local (one address space) User region virtual storage exhausted Check REGION, working storage size, LE heap growth
S878 RC=04/10 Out of real/auxiliary System-wide (all jobs) LPAR real storage exhausted Cancel low-priority work; capacity review
S878 RC=08 MEMLIMIT exceeded Local (one job) Above-bar allocation exceeds MEMLIMIT Increase MEMLIMIT in JCL
S0C4 Protection exception Local (one task) Subscript out of range, invalid pointer, storage overlay Map PSW address to COBOL source; check subscripts
S0C7 Data exception Local (one task) Invalid packed decimal data Check field initialization and data source validation

Region Size Formula

Required below-bar user region =
    Working Storage (compile listing)
  + LE runtime libraries (~25 MB)
  + Load module (link-edit listing)
  + File buffers (BUFNO × BLKSIZE per DD)
  + DB2 thread storage (~15 MB per thread)
  + LE heap (RPTSTG high-water mark)
  + LE stack (RPTSTG)
  + Safety margin (15-20%)

If Required > ~1,640 MB → LP(64) is MANDATORY
If Required > ~1,300 MB → LP(64) is RECOMMENDED

LE Storage Runtime Options

Option What It Controls CNB Batch Standard Key Insight
HEAP(init,incr,...) Heap segment allocation (1M,1M,ANYWHERE,KEEP,64M,32M) Start large to avoid expansion overhead
STACK(init,incr,...) Stack segment allocation (512K,512K,ANYWHERE,KEEP,512K,128K) Watch for deep call chains and LOCAL-STORAGE
STORAGE(xx,yy,zz) Storage initialization fill (00,FE,00) X'FE' in freed storage catches use-after-free
RPTSTG(ON/OFF) Storage utilization report ON (quarterly) The single most useful storage diagnostic
ALL31(ON/OFF) Require AMODE 31 for all modules ON Catches accidental below-line dependencies
MEMLIMIT Above-bar storage ceiling In JCL per job Required for LP(64) programs

CICS Storage: The Multiplication Effect

CICS ECDSA consumption = Per-task working storage × Concurrent tasks

Example:
  Working storage per task:  500 KB
  Concurrent tasks:          200
  ECDSA required:            100 MB (+ CICS overhead)

Danger zone:
  Working storage per task:  2.4 MB
  Concurrent tasks:          112
  ECDSA required:            269 MB → EXCEEDS 256 MB → SOS

Rule of thumb: Maximum per-task working storage in CICS: 500 KB. If you need more, use shared data tables, TSQs, or file reads for reference data.


Rules of Thumb

  • REGION=0M on all production batch jobs — always request maximum
  • Working storage > 500 MB → LP(64) — don't wait for the 80A
  • CICS working storage: multiply by concurrent tasks — the batch programmer's blind spot
  • RPTSTG quarterly — track storage growth before it becomes a crisis
  • STORAGE(00,FE,00) in all environments — 2-5% overhead buys enormous diagnostic value
  • Do the arithmetic before deployment — RPTSTG + compile listing + known user region → predicted headroom
  • CSA is shared across ALL address spaces — a CSA leak is a system-wide emergency
  • Page fault rate > 50/sec/address space — investigate real storage contention
  • The bar is hardware, not configuration — no tuning parameter makes it go away

Connection to Chapter 1

Ch 1 Concept Ch 2 Extension
Address space isolation DAT with per-address-space page tables provides the mechanism
DB2 cross-memory PC call PC instruction switches CR1, loading DB2's page tables
CICS quasi-reentrant model Each task gets own working storage copy from ECDSA
WLM service classes WLM's SRM component manages real storage allocation and page stealing
Parallel Sysplex / LPARs Each LPAR has its own real storage; virtual storage is not shared cross-LPAR