Summary -
In this topic, we described about the below sections -
- PICTURE clause specifies the characteristics and editing requirements of the variable. i.e., variable type, length etc.
- PICTURE clause only coded with elementary variables and individual variables.
- PICTURE clause should not code with an 88-level number, USAGE COMP-1, and USAGE COMP-2.
Syntax -

level-number variable-name
[PIC/PICTURE data-type-character(variable-length)
[VALUE literal]]
OR
level-number variable-name
[PIC/PICTURE picture-symbol(variable-length)
[VALUE literal]]
OR
level-number variable-name
[PIC/PICTURE character-string
[VALUE literal]]
OR
level-number variable-name
[PIC/PICTURE picture-clause-editing
[VALUE literal]]
For example - Declaring a variable of alphabetic type to store a value HELLO.
01 WS-VAR PIC A(05) VALUE "HELLO".
- level-number - Specifies the level number of the declaration from 01 to 49. In the above example, it is 01.
- variable-name - Specifies the name of the variable. In the above example, it is WS-VAR.
- data-type-character/picture-symbol - Specifies the type of the variable. In the above example, it is A (Alphabetic).
- variable-length - Specifies the variable length to store the data. In the above example, it is 05 (variable length is 5).
- literal - Specifies the literal character string. In the above example, it is HELLO.
PICTURE or PIC -
- PIC is a short form for PICTURE and has the same meaning.
- The PICTURE clause should code with every elementary variable to specify its type along with length.
- The PICTURE clause should not specify for below -
- Index data items
- The RENAMES clause
- Internal floating-point data items
character-string -
- The character-string defines as a combination of picture-symbol and variable-length.
- Character-string can contain a maximum of 50 characters.
PICTURE Symbol -
- PICTURE symbol is the letter used to specify the type of the variable during the declaration.
- PICTURE character-strings are delimited only by separator space, separator comma, separator semicolon, or separator period.
- PICTURE symbols lowercase letters are equivalent to their uppercase representations.
- PICTURE symbols are two types -
- PICTURE symbol for data types
- PICTURE symbol for editing.
For example -
A, B, E, G, N, P, S, V, X, Z, CR, DB.
PICTURE symbol for data types -
PICTURE symbol for data types specifies the PICTURE symbols assigned for each data type in COBOL. Those are -
Data Type | PICTURE Symbol | Declaration Meaning | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Alphabetic | A | Alphabetic character or space. Represents alphabetic data type. For example -
|
|||||||||||||||
Numeric | 9 | Numeric character. Represents numeric data type. For example -
|
|||||||||||||||
Alphanumeric | X | Alphanumeric character or space. Represents alphanumeric data type. For example -
|
|||||||||||||||
Assumed decimal point | V | Represents the decimal point. It is not counted in the size of the data item/variable. For example -
| |||||||||||||||
Operational sign | S | Represents the Sign of the value. It is not counted in the size of the variable unless a SIGN clause with the SEPARATE CHARACTER phrase is specified. For example -
|
PICTURE symbol for editing -
PICTURE symbol for editing used to represent the data in the user expected format. PICTURE clause editing has two types to represent the data in user-specified format -
Type | PIC Symbols | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Insertion editing |
|
||||||||||
ZERO suppression and replacement editing |
|
Examples -
Below are the total PICTURE clause symbol list -
Symbol | Declaration Meaning | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
B | Space insertion character. Represents numeric-edited and alphanumeric-edited character. For example -
| ||||||||||||
P | Decimal scaling position but not counted in size of data item.
For example -
| ||||||||||||
Z | Zero suppression character.
For example -
| ||||||||||||
0 | Zero insertion character.
For example -
| ||||||||||||
/ | Slash insertion character.
For example -
| ||||||||||||
, | Comma insertion character.
For example -
| ||||||||||||
. | Decimal point or period editing control character.
For example -
| ||||||||||||
+ | Plus sign insertion editing control character.
For example -
| ||||||||||||
- | Minus sign editing control character.
For example -
| ||||||||||||
CR | Credit editing control character.
For example -
| ||||||||||||
DB | Debit editing control character or Check protect insertion character.
For example -
| ||||||||||||
$ | Currency symbol insertion character. $ is the default.
For example -
|
Data Type Vs Editing Type -
The type of editing allowed depends on the variable data type. The following table shows the valid type of editing with the corresponding category –
Data Type | Type of editing | Insertion symbol |
---|---|---|
Alphabetic | None | None |
Numeric | None | None |
Numeric-edited | Simple insertion Special insertion Fixed insertion Floating insertion Zero suppression Replacement | B 0 / , . cs + - CR DB cs + - Z * Z * + - cs |
Alphanumeric | None | None |
Alphanumeric-edited | Simple insertion | B 0 / |
External floating-point | Special insertion | . |