Figurative constant
A reserved COBOL word that stands for a value, such as SPACES, ZEROS, LOW-VALUES or HIGH-VALUES.
Also written LOW-VALUES, HIGH-VALUES, SPACES, ZEROS, ZEROES, QUOTES
Figurative constants are COBOL words that stand for values. MOVE SPACES TO WS-NAME fills the field with spaces, whatever its length. MOVE ZEROS TO WS-TOTAL fills it with zeros. ZERO, ZEROS and ZEROES all mean the same.
Two of them need explaining. LOW-VALUES is the lowest possible value of a byte, hexadecimal 00. HIGH-VALUES is the highest, hexadecimal FF. Neither is a character you can type or see.
Programs use them as markers. A common pattern when matching two sorted files is to move HIGH-VALUES to a file's key when it reaches its end, so it compares higher than any real key and the logic for the other file carries on naturally. LOW-VALUES are used to mean "nothing here", and in CICS screens, a field holding LOW-VALUES is not sent to the terminal at all.
Because they are not visible, they can cause confusion when they end up in data. A field that looks empty in browse may hold LOW-VALUES rather than spaces. HEX ON in the editor shows which it is.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- MOVEThe COBOL statement that copies a value into a field, converting it to fit the receiving field's format.
- INITIALIZEA COBOL statement that resets every field in a group to a default value suited to its type.
- WORKING-STORAGEThe section of a COBOL program that declares its internal variables: counters, totals, flags and work areas.
- HexadecimalA way of writing numbers in base 16, used everywhere on the mainframe to show the exact contents of bytes.
- READ and WRITEThe COBOL statements that open, read, write, update and close files.