Working Storage
All variable names used in application programs follow standard naming conventions. This lets you easily determine the source of a variable name. The following is an example of a working storage file.
000100*************************************************************
000200* XX01WS
000300*************************************************************
000400 01 XX01WS.
000500 02 XX01WS-CALC-HOURLY-PAY PIC S9(8)V99 VALUE ZEROES.
000600 02 XX01WS-HIREDT PIC 9(08) VALUE ZEROES.
000700 02 XX01WS-HIREDT-R REDEFINES XX01WS-HIREDT.
000800 03 XX01WS-HIREYY PIC 9(04).
000900 03 XX01WS-HIREMM PIC 9(02).
001000 03 XX01WS-HIREDD PIC 9(02).
The following rules apply to working storage data definition files, both to program-specific working storage and to working storage for library modules. For information on library modules, see Doc for Developers: Application Development Workbench.
-
A working storage file can have only one level 01 variable. The group name is the program code or library name, followed by WS.
-
Prefix all variables in the group with the group name and a hyphen (-). In the previous example, all variables start with PA01WS, which is the group name.
-
Separate the level number and the variable name with two spaces.
-
Indent a new level four spaces from the previous level.
-
When defining a group construct at levels other than 01, first define the group as an element, then redefine it into the subelements. The redefined name should have a suffix of -R, as in the previous example. In this construct, the redefined element name cannot have a VALUE clause.