Numeric edited field
A COBOL field whose PICTURE formats a number for people to read, with commas, decimal points, signs and no leading zeros.
Also written edited picture, zero suppression, PIC Z, numeric-edited item, report formatting
A numeric edited field is a field for showing a number, not calculating with it. Its PICTURE contains editing symbols, and when a number is moved into it, the number is formatted.
Some common symbols: Z replaces leading zeros with spaces. A comma and a full stop are placed exactly where they appear. A minus sign at the end shows a minus only for negative values, and CR or DB shows those letters for negative values, as on statements. An asterisk replaces leading zeros with asterisks, used on cheques so nobody can add digits. A currency sign can float to sit just before the first digit.
So PIC ZZZ,ZZ9.99- holding the value -1234.5 shows as 1,234.50- with spaces in front.
You cannot use an edited field in arithmetic, because it contains text such as commas. The usual pattern is to calculate in a normal numeric field, then MOVE the result into the edited field just before writing the report line or building the screen.
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
- PICTURE clauseThe COBOL declaration that says what kind of data a field holds and how long it is, written as PIC.
- MOVEThe COBOL statement that copies a value into a field, converting it to fit the receiving field's format.
- DISPLAY statementThe COBOL statement that writes a line of text, usually to the job's output, often used for messages and debugging.
- Packed decimalA compact way of storing numbers, two digits per byte, used heavily for amounts in business records.
- Zoned decimalThe default way COBOL stores numbers: one digit per byte, readable as text, with the sign hidden in the last byte.