CUCO study materials
CUCO study resources

CUCO: Data Division and Data Description

CUCO · Work through your exam, one topic at a time.

All guide sections

Data Division and Data Description

The Data Division domain tests whether you can describe storage precisely: level structure, PICTURE character strings, USAGE clauses, VALUE and REDEFINES rules, and the lifetime of each section. Exam items often ask for the byte length of a field or the effect of a MOVE between two descriptions.

Levels and sections

FILE SECTION describes records of files declared in FILE-CONTROL; WORKING-STORAGE is static; LOCAL-STORAGE is allocated per invocation; LINKAGE describes caller-provided storage. Levels 01–49 form groups and elementary items; 77 is an independent elementary item; 66 is RENAMES; 88 is a condition name attached to the preceding item. A group item has no PICTURE; an elementary numeric item normally does.

PICTURE and USAGE

9 numeric, X alphanumeric, A alphabetic, V implied decimal, S sign, P scaling, Z and asterisk zero suppression, CR/DB editing, B blank insertion, slash and zero insertion. Default USAGE DISPLAY is one byte per character. COMP/COMP-4 is binary: 1–4 digits use 2 bytes, 5–9 use 4, 10–18 use 8. COMP-3 is packed decimal: digits plus one sign nibble, rounded up to whole bytes. COMP-1/COMP-2 are floating point. INDEX, POINTER, NATIONAL and UTF-8 have their own sizes. SIGN LEADING/TRAILING SEPARATE adds a byte.

Rules that matter

REDEFINES must repeat the level number, immediately follow the redefined item, and cannot carry a VALUE clause. OCCURS defines tables; OCCURS DEPENDING ON makes the maximum size fixed at compile time. VALUE initializes WORKING-STORAGE at load and is ignored or illegal in LINKAGE. SYNCHRONIZED inserts padding for binary alignment.

Worked example. 05 AMT PIC S9(5)V99 COMP-3. has 7 digits (5 integer plus 2 decimal) plus a sign nibble = 8 nibbles = 4 bytes. The V is not stored. By contrast, 05 AMT2 PIC S9(3)V99 SIGN TRAILING SEPARATE. is DISPLAY: 3 + 2 digits plus one separate sign = 6 bytes. If the same 5-digit field were PIC S9(5) COMP, it would occupy 4 bytes because 5–9 digits map to a fullword.

Traps

  • MOVE between group items is alphanumeric: left-justified, space-padded, no decimal alignment.
  • Moving a longer numeric into a shorter numeric truncates high-order digits; no size error occurs on MOVE.
  • Numeric edited fields (Z, currency symbol, comma) cannot be used in arithmetic.
  • Putting VALUE on a REDEFINES item or a LINKAGE item.
  • Assuming WORKING-STORAGE is refreshed on every CALL; only INITIAL programs and LOCAL-STORAGE are.