Skip to main content
Module 4 · Lesson 1 of 27/16 in the course~15 min
Module lessons (1/2)

Hierarchical Records and Group Items

Lesson preview5 hands-on exercises readyCourse COBOL · Module 4 — Hierarchical Records and Tables OCCURS

Declare records 01 and subordinate fields 05/10, understand the impact of MOVE on group elements, and format contiguous reports.

What you'll learn in this lesson

  • Organize related fields into hierarchical records (01, 05, 10, 15) with contiguous layout in memory.
  • Predict the effect of MOVE on a group element (always treated byte-for-byte as an alphanumeric string).
  • Safely clear all fields of a mixed text/number record using INITIALIZE or MOVE CORRESPONDING.

Overview

In COBOL there are no dynamic objects on the heap: all the fields of a record are physically attached in sequence within the area allocated by the 01 level.

An element that has child fields under it is called Group Item and must NOT have the PIC clause: its total length is the sum of the bytes of the elementary fields only (elementary items):

Sections covered in this lesson

  1. 11. Level Hierarchy (01 / 05 / 10)
  2. 22. The MOVE trick (and risk!) on Group Items
  3. 33. Safe clean with INITIALIZE and copy with CORRESPONDING
  4. 44. FILLER for separators and fixed columns
  5. 5Try it yourself
Pro Lesson · Module 4 — Hierarchical Records and Tables OCCURS

Unlock "Hierarchical Records and Group Items" and the full Course COBOL curriculum

Declare records 01 and subordinate fields 05/10, understand the impact of MOVE on group elements, and format contiguous reports.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Course COBOL plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.