Skip to content
COBOL

PICTURE clause

The COBOL declaration that says what kind of data a field holds and how long it is, written as PIC.

Also written PIC, picture

The picture clause, almost always abbreviated PIC, defines a field's type and size. It is the most distinctive piece of COBOL syntax and the one to learn first.

The notation is compact. X means any character, so a field of X repeated thirty times holds thirty characters of text. The number 9 means a numeric digit. S marks a field as signed, so it can hold negatives. V marks an implied decimal point, which occupies no storage but tells the program where the decimal sits. Repetition is written in brackets rather than spelled out, so a long field is declared briefly.

There are also editing pictures used for output. These insert commas, decimal points, currency symbols, and turn leading zeros into spaces, so a stored number can be printed in a readable form without any formatting code.

The precision matters. Because COBOL knows the exact size and decimal placement of every numeric field, arithmetic on money behaves predictably, a guarantee that is much harder to get from languages using floating point.

Browse all 115 terms

Learn this properly.

Use PICTURE clause for real in Mainframe101, in your browser, with Zed beside you. Join the waitlist.

Early access and updates. No spam, unsubscribe any time.