TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

COBOL - Picture Clause Editing


  • Edited Pictures, are PICTURE clauses that format data intended for output to screen or printer. To enable the data items to be formatted, COBOL provides additional picture symbols to supplement the basic 9, X, A, V and S.

  • The additional symbols are referred to as "Edit Symbols," and PICTURE clauses that include edit symbols are called "Edited Pictures".

  • The term edit is used, because the edit symbols have the effect of changing, or editing, the data inserted into the edited item.

  • Edited items cannot be used as operands in a computation, but they may be used as the result or destination of a computation (they can be used in items placed to the right of the word GIVING).

In COBOL these things can be achieved using Edited Pictures.

Original value00023456.78
With commas inserted00,023,456.78
Plus zero suppression23,456.78
Plus floating currency symbol$23,456.78
With anti-fraud printing$***23,456.78

There are two general methods of editing in a PICTURE clause:
  • Insertion editing:
    • Simple insertion

    • Special insertion

    • Fixed insertion

    • Floating insertion


  • Suppression and replacement editing:
    • Zero suppression and replacement with asterisks

    • Zero suppression and replacement with spaces

The type of editing allowed for an item depends on its data category. The type of editing that is valid for each category is shown in the following table. cs indicates any valid currency symbol.

Data categoryType of editingInsertion symbol
AlphabeticNoneNone
NumericNoneNone
Numeric-editedSimple insertion
Special insertion
Fixed insertion
Floating insertion
Zero suppression
Replacement
B 0 / ,
.
cs + - CR DB
cs + -
Z *
Z * + - cs
AlphanumericNoneNone
Alphanumeric-editedSimple insertionB 0 /
DBCSSimple insertionB
External floating-pointSpecial insertion.
NationalNoneNone
National-editedSimple insertionB 0 /

Types of editing are described in the following sections:
  • Simple insertion editing.

  • Special insertion editing

  • Fixed insertion editing.

  • Floating insertion editing.

  • Zero suppression and replacement editing.


See more detailed explanation on each type of editing in next chapter..

If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal