Chapter 2 Exercises: Virtual Storage Architecture
Part A: Conceptual Questions
A1. Explain how Dynamic Address Translation (DAT) provides address space isolation. Why does the same virtual address (e.g., X'1A4F3200') in two different address spaces map to different real storage locations? What hardware component makes the switch when the dispatcher changes tasks?
A2. Describe the difference between virtual storage and real storage. Why can z/OS run 200 address spaces, each with a 2 GB virtual range, on a machine with only 256 GB of real storage? What happens when the system runs low on real storage?
A3. Define the "bar" and the "line" in z/OS virtual storage. Why is the bar at 2 GB rather than 4 GB? What historical design decision from the 24-bit era caused this?
A4. Explain the difference between the REGION parameter and the MEMLIMIT parameter. What does each control? Can you increase usable below-bar storage beyond ~1.6 GB by changing REGION? Why or why not?
A5. List and explain four system areas that consume address space storage before your COBOL program gets any: CSA, SQA, LSQA, and the nucleus. For each, explain what it contains and why it matters to a COBOL architect.
A6. Describe the LE heap and the LE stack. What COBOL constructs cause heap allocation? What causes stack allocation? Why is putting a large table in LOCAL-STORAGE dangerous in a CICS environment?
A7. Explain the difference between system completion codes 80A and 878. One is a local problem; one is system-wide. Which is which, and why does the distinction matter for your response as an architect?
A8. Describe the concept of "overcommit" in z/OS virtual storage. Why is demand paging essential for overcommit to work? What condition results when overcommit exceeds the system's capacity to manage it?
Part B: Applied Analysis
B1. Region Size Calculation
A COBOL batch program at Pinnacle Health Insurance has the following storage profile:
| Component | Size |
|---|---|
| Working storage (from compile listing) | 720 MB |
| LE runtime libraries | 25 MB |
| Load module | 12 MB |
| VSAM buffers (4 files, BUFND=20 each, 4K CI) | ? |
| QSAM buffers (2 sequential files, BUFNO=5, BLKSIZE=27998) | ? |
| DB2 thread storage (3 threads) | ? |
| LE heap (estimated from RPTSTG) | 35 MB |
| LE stack | 3 MB |
a) Calculate the VSAM buffer storage. Each VSAM file has BUFND=20 data buffers and BUFNI=5 index buffers. CI size is 4,096 bytes for data and 2,048 bytes for index. Total across 4 files?
b) Calculate the QSAM buffer storage. BUFNO=5, BLKSIZE=27,998 for each of 2 files.
c) Calculate the DB2 thread storage at 15 MB per thread for 3 threads.
d) What is the total required below-bar storage including a 20% safety margin?
e) Assuming ~1,640 MB of available user region, will this program fit? If not, what is your recommendation?
B2. CICS DSA Sizing
A CICS AOR at SecureFirst Retail Bank handles three transaction types:
| Transaction | Working Storage per Task | Peak Concurrent Tasks |
|---|---|---|
| INQY (inquiry) | 200 KB | 150 |
| XFER (transfer) | 500 KB | 80 |
| LOAN (payment) | 350 KB | 40 |
a) Calculate the total ECDSA requirement at peak concurrency (all transaction types at peak simultaneously).
b) Add 30% overhead for CICS internal use and LE per-task overhead. What ECDSA setting would you recommend?
c) Yuki Nakamura discovers that a developer deployed an INQY program update with 2 MB of working storage (up from 200 KB). At 150 concurrent tasks, what happens? Calculate the new ECDSA requirement.
d) What architectural control would you implement to prevent this from happening again?
B3. Above-the-Bar Migration Planning
Federal Benefits Administration has a COBOL program (FBASUMM1) with the following profile: - Working storage: 1.4 GB (large reference tables for benefit calculation) - Currently AMODE 31 — runs on a good day with REGION=0M but is fragile - Contains 15 large tables (OCCURS DEPENDING ON) - Must continue running during migration (can't take extended downtime)
a) Why will this program eventually fail with 80A even though it currently runs?
b) Describe a phased migration strategy to move this program above the bar. Which tables would you move first? How would you test?
c) What LE runtime option changes are needed? What JCL changes?
d) What MEMLIMIT value would you set and why?
B4. Storage Abend Root Cause Analysis
You're reviewing abend data from four different production incidents at CNB. For each, identify the most likely root cause and the correct remediation:
Incident 1: Job CNBAR450 abends S80A RC=04. REGION=0M. Working storage is 900 MB. The job ran successfully for six months. This is the first failure.
Incident 2: Multiple unrelated jobs on CNBPROD2 all abend S878 RC=04 within a 10-minute window. The jobs have varying REGION and MEMLIMIT settings.
Incident 3: CICS transaction XFER abends S0C4 intermittently — approximately 1 in 500 transactions. The abend always occurs at the same offset in the COBOL program, corresponding to a MOVE statement that copies data from an input record to working storage.
Incident 4: Job CNBRPT100 abends S0C7 on the first day of every quarter. It runs successfully every other day. The 0C7 occurs during a COMPUTE statement that calculates quarterly averages.
B5. Virtual Storage Fragmentation
A long-running COBOL batch program at CNB processes records continuously for 8 hours. It calls 15 different subprograms via dynamic CALL. Each subprogram allocates working storage on the LE heap. The program CALLs subprograms in varying order — sometimes SUBA, then SUBB, then SUBA again.
a) Explain how this pattern can cause heap fragmentation even if total storage usage remains constant.
b) What happens if the heap becomes fragmented and LE needs to allocate a large contiguous block?
c) What LE runtime option would you use to diagnose this? What pattern would you look for in the output?
d) What code change could reduce fragmentation? (Hint: think about subprogram lifecycle.)
B6. CSA Exhaustion Scenario
A third-party monitoring tool installed on CNB's LPAR is leaking CSA storage — allocating 50 KB per minute without freeing it.
a) How many hours until the tool has leaked 1 GB of CSA?
b) What symptoms would operators see as CSA fills? Which address spaces are affected?
c) How would you detect this leak using z/OS operator commands and RMF?
d) Why is a CSA leak more dangerous than a private-area storage leak?
Part C: Calculation and Estimation
C1. A z/OS LPAR has 256 GB of real storage. It is running 180 active address spaces. The average page fault rate across all address spaces is 8 per second. Each page fault requires approximately 1 millisecond to resolve (reading from auxiliary storage on flash). Calculate: (a) the total time per second spent resolving page faults, (b) the percentage of CPU time consumed by page fault handling (assume 8 CPs), (c) at what page fault rate would page handling consume 10% of a single CP.
C2. A COBOL program defines a table:
01 WS-ACCOUNT-TABLE.
05 WS-ACCT-ENTRY OCCURS 2000000 TIMES.
10 WS-ACCT-NUMBER PIC X(12).
10 WS-ACCT-NAME PIC X(50).
10 WS-ACCT-TYPE PIC X(3).
10 WS-ACCT-STATUS PIC X(1).
10 WS-ACCT-BALANCE PIC S9(13)V99 COMP-3.
10 WS-ACCT-LIMIT PIC S9(13)V99 COMP-3.
10 FILLER PIC X(16).
a) Calculate the size of one entry in bytes. (Remember COMP-3 packing rules.)
b) Calculate the total table size for 2,000,000 entries.
c) Will this table fit below the bar in a batch program? Show the arithmetic.
d) If the table needs to support 5,000,000 entries in the future, what's the architect's recommendation?
C3. Four VSAM files are allocated to a batch job with the following buffer configurations:
| File | CI Size (Data) | BUFND | CI Size (Index) | BUFNI |
|---|---|---|---|---|
| ACCTMAST | 8,192 | 30 | 4,096 | 10 |
| TXNLOG | 4,096 | 50 | 2,048 | 8 |
| REFDATA | 16,384 | 15 | 4,096 | 5 |
| ERRFILE | 4,096 | 10 | 2,048 | 3 |
Calculate the total buffer storage in MB. Would you consider this a significant portion of the user region?
C4. A CICS region has ECDSA=256 MB. The region runs an average of 120 concurrent tasks, each with an average working storage of 400 KB. LE per-task overhead is approximately 50 KB. Calculate: (a) total working storage consumption at average load, (b) ECDSA utilization percentage, (c) the maximum concurrent tasks before ECDSA is exhausted (assuming all tasks use 400 KB + 50 KB overhead).
C5. A COBOL program's RPTSTG report shows:
Total heap storage used: 45,088,768 bytes
Total stack storage used: 2,097,152 bytes
Maximum storage used: 823,132,160 bytes
Region size: 1,702,887,424 bytes
a) Calculate heap and stack as a percentage of total storage used.
b) Calculate the remaining available storage (headroom) as a percentage of region size.
c) If this program's working storage grows by 15% per year due to business requirements, how many years until it risks an 80A abend? (Assume all growth is in working storage and other components remain constant.)
Part D: Design Problems
D1. Storage Architecture for a New Application
You are designing a new COBOL batch application for Pinnacle Health Insurance that will: - Load a provider network reference table (1.2 million providers × 800 bytes/provider) - Process 50 million claims records (one pass through a VSAM KSDS) - Perform DB2 lookups for each claim against a benefits table - Write exception records to a sequential file - Produce a summary report
Design the storage architecture: a) Calculate working storage requirements for the reference table b) Estimate total below-bar storage needs (working storage + buffers + LE + DB2 + overhead) c) Determine whether LP(64) is required. If so, what MEMLIMIT? d) Specify LE runtime options (HEAP, STACK, STORAGE) e) Document the REGION and MEMLIMIT JCL parameters
D2. CICS Storage Governance Policy
Carlos Vega at SecureFirst Retail Bank has been asked to create a CICS storage governance policy. His mobile API layer sends 5,000 transactions per second to CICS. Working storage bloat in CICS programs is a recurring problem.
Design a governance policy that includes: a) Maximum working storage per CICS program (with justification) b) Review process for programs that exceed the limit c) Monitoring approach (what metrics, what thresholds, what alerts) d) Alternative architectures for programs that genuinely need large working storage e) Testing requirements before production deployment
D3. Storage Growth Projection
Federal Benefits Administration's COBOL programs are growing in storage consumption as new benefit programs are added. Sandra Chen needs a 5-year storage growth projection.
Current state: 45 critical batch programs. Average working storage: 350 MB. Maximum: 1.4 GB. Growth rate: ~12% per year (new benefit categories, expanded reference tables).
a) Project the average and maximum working storage for years 1 through 5. b) In which year does the average program risk hitting the bar? c) In which year does the maximum program become unable to run even with LP(64) at MEMLIMIT=8G? d) Propose a migration timeline: which programs should be converted to LP(64) first? What criteria do you use for prioritization?
Part E: Production Scenarios
E1. You are on the 2 AM bridge call. Three batch jobs on CNBPROD3 have abended in the last 20 minutes: one S80A, one S878, and one S0C4. The S80A and S878 were different jobs; the S0C4 was a restart of the S80A job. Walk through your diagnostic process: what commands do you issue, what data do you check, and in what order? What does the combination of S80A + S878 on the same LPAR tell you?
E2. Diane Okoye at Pinnacle Health Insurance discovers that their claims processing batch job is running 40% slower than the same period last year. No code changes were made. RPTSTG shows that heap storage used has tripled (from 50 MB to 150 MB). The program calls 8 subprograms dynamically. What is the most likely explanation? How would you confirm your hypothesis? What is the fix?
E3. Marcus Whitfield at Federal Benefits Administration is documenting a 35-year-old COBOL program before he retires. The program uses OS macros (GETMAIN/FREEMAIN directly, not via LE) to manage its own storage. It's AMODE 24. It processes data that's grown from 100,000 records in 1990 to 12 million records today. The program has never been recompiled — it runs from the original 1990 load module. What storage risks exist? What modernization steps would you recommend, and in what order?
E4. SecureFirst Retail Bank is experiencing an intermittent S0C4 abend in their mobile banking CICS transaction. The abend occurs roughly once per 50,000 transactions. It always occurs in the same COBOL program but at different offsets. Yuki Nakamura has added CEEDUMP analysis and SSRANGE to the QA environment, but the abend does not reproduce in QA. What production-safe diagnostic techniques would you apply? What does "same program, different offsets" suggest about the root cause?
Part M: Mixed Practice (Spaced Review of Chapter 1)
M1. In Chapter 1, you learned that CICS uses a quasi-reentrant model where multiple tasks share the QR TCB. Explain how this model interacts with virtual storage: specifically, why does each CICS task get its own working storage copy, and where in the CICS address space's virtual storage are these copies allocated?
M2. Chapter 1 described DB2's cross-memory PC call mechanism. Using your new understanding of DAT and address space page tables, explain precisely what happens at the hardware level when the PC instruction transfers control from your batch initiator's address space to the DB2 DBM1 address space. Which control register changes? Why is the PC instruction faster than a SVC for this purpose?
M3. In Chapter 1, you designed a Parallel Sysplex configuration with multiple LPARs. Each LPAR has its own real storage allocation. Explain: (a) does virtual storage change between LPARs? (b) can a page fault on one LPAR affect performance on another LPAR? (c) how does the coupling facility's storage relate to the virtual/real storage model described in this chapter?
M4. Rob Calloway (Chapter 1) manages the overnight batch window at CNB. Using the storage concepts from this chapter, explain why a batch job that works fine at 11:30 PM might fail with S878 at 2:30 AM. What is different about the system's storage state at 2:30 AM versus 11:30 PM?
M5. Chapter 1 introduced WLM service classes. Explain how WLM's Storage Management component interacts with the virtual storage concepts in this chapter. Specifically: when a system is under real storage pressure, how does WLM decide which address space's pages to steal? Why does this decision affect COBOL program performance?