Skip to content

Working-Storage Section

The Working-Storage Section contains descriptions of data items used by the program internally.

General Format:

       [ WORKING-STORAGE SECTION. ] 
       [ ws-data-level ws-data-description ] 

Syntax:

The clauses supported by the data description are described in the Data Description section.

General Rules:

  1. ws-data-level is a data level number between 01 and 49 (inclusive), 66, 77, 78, or 88. For more information about data level numbers, see the Data Level Numbers section.
  2. ws-data-description describes the format and size of a data item that is used by the program internally.
  3. The default data initialization behaviour of the runtime corresponds to the declaration of the program in the PROGRAM-ID clause in the IDENTIFICATION DIVISION. If the program is described as IS INITIAL PROGRAM, IS COMMON PROGRAM, or IS RECURSIVE PROGRAM, the default behaviour of the runtime is to initialize alphanumeric data items to spaces, numeric data items to zeroes, and pointer data items to null every time the program is loaded.
  4. If there is no specific description, the program is considered a RESIDENT program, and the default behaviour of the runtime is to initialize alphanumeric data items to spaces, numeric data items to zeroes, and pointer data items to null the first time the program is loaded. When the program is called subsequently, the data items in the Working-Storage Section retain their state, unless the program has been the target of the CANCEL statement.
  5. Working-Storage variables may be created with an initial value using the VALUE clause.
  6. The default data initialization behaviour of the runtime can be altered with the default-byte-setting and use-defaultbyte settings in the compiler configuration file.
    For example, to cause all Working-Storage data items except those with explicit VALUE statements to be initialized to low-values when a program is initially loaded:
    In the compiler configuration flag, set:
       Defaultbyte: 0
       Use-defaultbyte: yes
Back to top