COBOL Picture Clause

COBOL Data Types COBOL Value Clause

Advertisements


PICTURE clause specifies the characteristics of the elementary items. i.e. type of data item, length etc,.

PICTURE clause comes up with elementary items only.

PICTURE clause should not come with 88 level number, USAGE is COMP-1 & COMP-2.

PICTURE clause can be edited to represent the data in the user expected format.

PICTURE clause editing has two types of Editing to represent the data in user specified format.


  1. Insertion editing
    • Simple insertion
    • Special insertion
    • Fixed insertion
    • Floating insertion
  2. ZERO Replacement and suppression editing
    • Zero suppression and replacement with spaces
    • Zero suppression and replacement with asterisks

Simple insertion editing:


Valid for numeric and alpha-numeric data items.

The length of the edited PICTURE clause need not be same as source PICTURE clause.

Each Edited PICTURE will calculate its position from the source PICTURE clause based on its position and replaces the same.


Simple insertion editing - Examples:



Special insertion editing:


Valid for Numeric and floating point data items.

The length of the edited PICTURE clause need not be same as source PICTURE clause.

The period (.) is the special insertion symbol for this type.

The period also counted during the edited PICTURE place calculation.


Special insertion editing - Examples:



Fixed Insertion editing:


Valid for numeric data items only.

The symbols used in this editing are -,+,CR,DB and $.

The length of the edited PICTURE clause need not be same as source PICTURE clause.

The above symbols counted during the edited PICTURE place calculation.

Display the fixed data positions in the editing.


Fixed Insertion editing - Examples:



Floating insertion editing:


Valid for numeric data items only.

The symbols used in this editing are -,+,CR,DB and $.

The length of the edited PICTURE clause need not be same as source PICTURE clause.

The above symbols counted during the edited PICTURE place calculation.

Display the floating data positions in the editing.


Floating Insertion editing - Examples:



ZERO Replacement and suppression editing:


Valid for numeric data items only.

Used to replace the ZEROES in the input data.

The symbols used in this editing are Z and *.

The length of the edited PICTURE clause need not be same as source PICTURE clause.

The above symbols counted during the edited PICTURE place calculation and will be replaced accordingly.

If Z is specified, the 0 will be replaced by space.

If * is specified, the 0 will be replaced by *.


ZERO Replacement and suppression editing - Examples:



COBOL Data Types COBOL Value Clause

Advertisements