COBOL - Value Clause
- The VALUE clause is used to set an initial value to the working storage variable.
- This can be specified only in the working storage variable.
- The VALUE Clause cannot be a part of RECORD DESCRIPTION entry in the FILE SECTION.
Examples: 01 W04-X-PGM-NAME PIC X(08) VALUE 'PXXBB290'. |
In the above example the variable W04-X-PGM-NAME is set to an initial value of PXXBB290.
The alphanumeric and Alphabetic items can be initialized to Spaces and numeric items can be initialized to Zeros.
Example 1: Alphanumeric
01 W04-NAME PIC X(08) VALUE SPACES. |
Example 2: Alphabetic
01 W04-LAST-NAME PIC A(08) VALUE SPACES. |
Example 3: Numeric
01 W04-MOBILE PIC 9(08) VALUE ZEORES. |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!