Data and storage

COBOL describes its storage before it does anything with it, and these lessons are that description. PICTURE clauses, level numbers, VALUE and the USAGE clauses decide what a field holds and how many bytes it takes; the sign, MOVE, REDEFINES and RENAMES then decide what those bytes can be read as. The part ends on level 78 and alignment.

011 PICTURE: X, 9, A and mixed fields PIC X(n), PIC 9(n), PIC A, repetition, PIC 9(3)V99 and what each clause claims Open 012 Level numbers 01 to 49, 77 and 88 group and elementary items, a 01 record, 77 independent items, 88 condition names Open 013 VALUE clauses and the initial state VALUE, VALUE ALL, INITIALIZE, and what a fresh run really holds Open 014 USAGE DISPLAY and zoned decimals one byte per digit, the sign nibble, MOVE into DISPLAY and the byte count of a field Open 015 USAGE COMP and COMP-5 binary storage, native byte order in COMP-5, the sizes, and an overflow that COMP hides Open 016 USAGE COMP-3 and packed decimals two digits a byte, the sign nibble, LENGTH OF, and which usage to choose Open 017 SIGN LEADING, TRAILING and SEPARATE where the sign lives, SIGN IS, an overpunched byte read one character at a time Open 018 MOVE: numeric, alphanumeric and groups truncation, space padding, group moves, MOVE CORRESPONDING and what it skips Open 019 REDEFINES the same bytes under two descriptions, a header read as a detail record, the rules that make it legal Open 020 RENAMES and level 66 a second view of a group's bytes, what level 66 may and may not describe Open 021 Level 78 and figurative constants 78 as a compile-time constant, SPACE, ZERO, HIGH-VALUE, QUOTE and ALL Open 022 SYNC and alignment padding the compiler inserts, SYNC, LENGTH OF with and without it, and why a file record must not use SYNC Open

Lessons