Module 5: Data Division
LOCAL-STORAGE SECTION
- LOCAL-STORAGE SECTION is similar to WORKING-STORAGE SECTION and it is also used to describe variables but only difference is they get initialized for every invocation of the program in the run unit
- The LOCAL-STORAGE SECTION defines storage that is allocated and freed on a per-invocation basis.
- On each invocation, data items defined in the LOCAL-STORAGE SECTION are reallocated and initialized to the value assigned in their VALUE clauses.
- Data items defined in the LOCAL-STORAGE SECTION cannot specify the EXTERNAL clause.
- The LOCAL-STORAGE SECTION must begin with the header LOCAL-STORAGE SECTION followed by a separator period.
- The basic structure of LOCAL-STORAGE SECTION is given below:-
DATA DIVISION. LOCAL-STORAGE SECTION. [ls-section-entries…]
- Example:-
DATA DIVISION. LOCAL-STORAGE SECTION. 01 NUM PIC 9(04).