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

COBOL - Data Items


Data Items - User defined variables:

The main objectives of the chapter are:

  • Identify the various data items in a COBOL program.

  • Example 1:

    05 W01-STRING PIC X(20) VALUE 'ABC'.

    • 05 -> Level Number

    • W01-STRING -> Data Name

    • PIC X(20) -> Picture Clause

    • VALUE 'ABC' -> Value Clause

    The Variable W01-STRING is of Character Type(X) and of length twenty(20). The prefix W denotes that the variable belongs to Working Storage section. It is not mandatory to start the variable name with 'W'. this is just for reference. The VALUE clause assigns the default value as 100.

  • Example 2:

    01 W02-NUM PIC 9(03) VALUE 100.

    • 01 -> Level Number

    • W02-NUM -> Data Name

    • PIC 9(03) -> Picture Clause

    • VALUE 100 -> Value Clause

    The Variable W02-NUM is of Numeric Type(9) and of length three(03). The prefix W denotes that the variable belongs to Working Storage section. The VALUE clause assigns the default value as 100.

We will see detailed explanation on below topics in next chapter..
  1. Level Number

  2. Data Name

  3. Picture Clause

  4. Value Clause


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