COBOL Working Storage Section
WORKING-STORAGE SECTION is used to define the general variables, the additional sections under it.
WORKING-STORAGE SECTION defines the data names that the program needs for internal manipulations of data.
WORKING-STORAGE SECTION fields used for internal usage in the program and will not be accessed outside of the program.
All the WORKING-STORAGE SECTION fields will be initialized when the program execution starts.
Memory will allocated to all WORKING-STORAGE SECTION fields when the execution starts and memory will be de-allocated when the execution ends.
WORKING-STORAGE SECTION used for temporary storage for fields declared in the same section during the execution of the program.
WORKING-STORAGE SECTION reserves the memory which is not included in the input or output of the program.
DATA DIVISION. WORKING-STORAGE SECTION. [Working-storage fields declaration]
Let’s take simple example to display the working storage fields which are already initialized during the declaration.
01 level number will be coded in Area-A always.
All other level numbers will be coded in Area-B always.
A simple program shows the variables declaration in working-storage section
COBOL File Section COBOL Linkage Section