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.

2.1 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 2.2 Level numbers 01 to 49, 77 and 88 group and elementary items, a 01 record, 77 independent items, 88 condition names Open 2.3 VALUE clauses and the initial state VALUE, VALUE ALL, INITIALIZE, and what a fresh run really holds Open 2.4 USAGE DISPLAY and zoned decimals one byte per digit, the sign nibble, MOVE into DISPLAY and the byte count of a field Open 2.5 USAGE COMP and COMP-5 binary storage, native byte order in COMP-5, the sizes, and an overflow that COMP hides Open 2.6 USAGE COMP-3 and packed decimals two digits a byte, the sign nibble, LENGTH OF, and which usage to choose Open 2.7 SIGN LEADING, TRAILING and SEPARATE where the sign lives, SIGN IS, an overpunched byte read one character at a time Open 2.8 MOVE: numeric, alphanumeric and groups truncation, space padding, group moves, MOVE CORRESPONDING and what it skips Open 2.9 REDEFINES the same bytes under two descriptions, a header read as a detail record, the rules that make it legal Open 2.10 RENAMES and level 66 a second view of a group's bytes, what level 66 may and may not describe Open 2.11 Level 78 and figurative constants 78 as a compile-time constant, SPACE, ZERO, HIGH-VALUE, QUOTE and ALL Open 2.12 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