Start of change

WORKING-STORAGE SECTION changes

The allocation and management of WORKING-STORAGE SECTION have been changed since Enterprise COBOL V5. This does not affect the execution of the COBOL program. Tools or programs that need to locate the starting address of the WORKING-STORAGE SECTION might be affected. You can use the following method to locate the WORKING-STORAGE in Enterprise COBOL V5 and V6 programs at run time.

To find the start of WORKING-STORAGE in COBOL V5 and V6, you need to know how to locate the PPA4 (Program Prologue Area 4) in a dump.

How to find the PPA4 (Program Prolog Area 4) in a dump?

  1. Find the start of the program in the dump from the traceback.
  2. At the starting address + x'0C' is an offset value. This is the offset to the PPA1 from the start of the program.
  3. Starting address + PPA1 offset = PPA1.
  4. Go there in the dump.
  5. At PPA1 + x'04' is an offset value. This is the offset to the PPA2 from the start of the program.
  6. Starting address + PPA2 offset = PPA2.
  7. Go there in the dump.
  8. At PPA2 + x'08' is an offset value. This is the offset to the PPA4 from the PPA2 address.
  9. PPA2 + PPA4 offset = PPA4.
  10. Go there in the dump. You are now at the PPA4.
Next, you need to know the layout of the PPA4.

PPA4 layout

The major fields in PPA4 that you need are as follows:

Start of change
Offset   Length   Description            
X'08'    4        Address of NORENT static                       A(NORENTstatic)
X'0C'    4        Signed offset from WSA to 32-bit RENT static   Q(RENTstatic)
X'10'    4        Signed offset from 32-bit RENT static to       A(DATA24_31_address_cell-RENTstatic)
                  program static address cell.
                  Note: You need to dereference (get the value in storage at) the address cell to 
                  get the address of the program static area.
X'14'    4        Offset of user code from PPA4                  A(Code-PPA4)
X'18'    4        Length of user generated code                  Code Length
X'1C'    4        Length of NORENTstatic area                    Length NORENTstatic
X'20'    4        Length of RENTstatic area                      Length RENTstatic
X'24'    4        Length of DATA31 area                          Length DATA24_31
X'28'    4        Offset of program name from PPA4               A(CUName-PPA4)
X'2C'    4        Offset of WORKING-STORAGE (from Q(RENTstatic) or A(DATA24_31_address_cell-RENTstatic))
X'30'    4        Length of WORKING-STORAGE 
X'34'    1        Byte with bit to indicate if the program has EXTERNAL data items
End of change

For information about each PPA4 offset, length, and description, see the COBOL V5 32-bit PPA4 layout table in the z/OS® Language Environment® Vendor Interfaces.

Next, you need to know some terminology.

Terms to know

NORENT static area
This storage area is allocated in the executable for each program that was compiled with NORENT. A NORENT program’s WORKING-STORAGE will be located here.
LE’s writable static area (WSA)
Every COBOL V5 or V6 program object (executable) has this storage area.
RENT static area
This storage area is allocated inside the WSA for every program that is statically bound into the executable and compiled with RENT. Each program has their own RENT static area. A program’s WORKING-STORAGE may or may not be located here.
Program static area
This storage area is allocated outside of the WSA only if certain conditions are met. In those cases, the program’s WORKING-STORAGE will be located here, instead of in the RENT static area.

Next, you need to understand that there are three locations where WORKING-STORAGE can reside.

Explanation of the areas where WORKING-STORAGE can reside

There are three different locations where WORKING-STORAGE can reside:
  • Inside the program object (executable). All programs compiled with the NORENT option have a NORENT static area reserved within the executable and WORKING-STORAGE resides here.
  • All programs compiled with the RENT option have a RENT static area allocated inside LE’s WSA (writable static area). WORKING-STORAGE could reside here.
  • Instead of being located in the RENT static area, some COBOL V5 or later RENT programs have their WORKING-STORAGE allocated outside of LE’s WSA, in an area called the program static area.
The rules for determining where WORKING-STORAGE resides are located in the next section.

The picture below shows how storage is laid out for RENT programs whose WORKING-STORAGE resides in the program static area:

        Program Object (Executable)
  (Has two programs A & B statically bound.)
|-------------------------------------------|
|                                           |
|      LE’s WSA (writable static area)      |    
|  |-------------------------------------|  |        
|  |                                     |  |        
|  |                                     |  |        
|  |    Program A - RENT static area     |  |                                 
|  |  |-------------------------------|  |  |    
|  |  | (Corresponds to the STATIC    |  |  |        
|  |  | MAP in Program A’s listing)   |  |  |        
|  |  |-------------------------------|  |  |        
|  |                                     |  |        
|  |                                     |  |        
|  |    Program B - RENT static area     |  |                                 
|  |  |-------------------------------|  |  |    
|  |  | (Corresponds to the STATIC    |  |  |        
|  |  | MAP in Program B’s listing)   |  |  |        
|  |  |-------------------------------|  |  |        
|  |                                     |  |        
|  |                                     |  |
|  |-------------------------------------|  |    
|                                           | 
|                                           |
|                                           |
|    Program A – program static area        |    
|  |-------------------------------------|  |        
|  | (Corresponds to the WORKING-STORAGE |  |                                     
|  | MAP (or the WSA 24 MAP) in          |  |        
|  | Program A’s listing)                |  |        
|  |-------------------------------------|  |        
|                                           |        
|                                           | 
|    Program B – program static area        |    
|  |-------------------------------------|  |        
|  | (Corresponds to the WORKING-STORAGE |  |        
|  | MAP (or the WSA 24 MAP) in          |  |        
|  | Program B’s listing)                |  |        
|  |-------------------------------------|  |        
|                                           |        
|-------------------------------------------|
Once you understand the three areas where WORKING-STORAGE could reside, you need to know how to determine where a program’s WORKING-STORAGE actually does reside.

How to determine the area where WORKING-STORAGE is located?

Table 1. Area where WORKING-STORAGE is located
COBOL versions Compiler options Where is WORKING-STORAGE located?
COBOL V5 NORENT In the program's NORENT static area
RENT, DATA(31) In the program's RENT static area inside the WSA
RENT, DATA(24) or RENT, WSOPT1 In the program's program static area outside the WSA
COBOL V6 or later versions NORENT In the program's NORENT static area
RENT, DATA(31) & SPANNED RECORDS (i.e. the WSOPT bit is OFF)2 In the program's RENT static area inside the WSA
RENT, DATA(24) (i.e. the WSOPT bit is ON)2 In the program's program static area outside the WSA
RENT, DATA(31) & NO SPANNED RECORDS (i.e. the WSOPT bit is ON)2 In the program's program static area outside the WSA
Notes:
  1. In COBOL V5, there is a WSOPT compiler option. In COBOL V6, there is no longer a WSOPT compiler option, but rather a signature information bit for WSOPT that is automatically set by the compiler.
  2. For SPANNED RECORDS, the WSOPT signature information bit is OFF. For NO SPANNED RECORDS, the WSOPT signature information bit is ON.
    • You can scan your programs for 'RECORDING MODE' and look for any files set to 'S' to determine if SPANNED RECORDS are used.
    • Another alternative is to check the signature information bytes in the listing for the WSOPT bit, which is signature byte 8, bit 3. For example, take the following from a listing:
      =X'001000000000'   INFO. BYTES 7-12  
      Byte 8 is x'10', which is b'00010000'. Numbering the bits from left to right as 01234567, because bit 3 is on, WSOPT is on.
Once you know what area the WORKING-STORAGE resides in, then you will know how to find it.

How to find WORKING-STORAGE in a dump?

Table 2. How to find the PPA4, NORENT static area, LE’s WSA, RENT static area, and program static area in a dump?
What to find? How to find it in a dump?
PPA4 See the instructions above.
NORENT static area The address is located in storage at <PPA4 + x'08'>
LE’s WSA The address is located in storage at <CEECAA (or R12) + x'1F4'>.
This is called CEECAARENT in a dump.
RENT static area The address is located in storage at
<The address in storage at CEECAA (or R12) + x'1F4'> +
<the offset in the program’s PPA4 + x'0C'>
Program static area The address is located in storage at
<The address in storage at CEECAA (or R12) + x'1F4’> +
<the offset in the program’s PPA4 + x'0C'> +
<the offset in the program’s PPA4 + x'10'>

Once you find these areas in a dump, then you can compare that to the compile listing.

In a COBOL listing:
  • The STATIC MAP shows the layout of the RENT static area or the NORENT static area.
  • The WORKING-STORAGE MAP or the WSA 24 MAP shows the layout of the program static area.

Use the LE vendor interface IGZXAPI to query the WORKING-STORAGE address

The COBOL-specific vendor interface routine, IGZXAPI, can also be used to query the WORKING-STORAGE address. With Enterprise COBOL V6.1, the LE vendor interface IGZXAPI is enhanced with new function code 8 to request information about the WORKING-STORAGE SECTION length and address for a COBOL program. The returned address corresponds to the STATIC MAP section in the COBOL compiler listing. Other information, such as the program name from PROGRAM-ID and signature information bytes (correspond to the “Compiler Options and Program Information Section” of the compiler listing), are also returned.

This enhancement is introduced in COBOL Runtime LE PTF for APAR PI49703. For more information about IGZXAPI, see IGZXAPI in the z/OS Language Environment Vendor Interfaces.

related tasks  
Reading LIST output (Enterprise COBOL for z/OS Programming Guide)
related references  
Example: Program prolog areas (Enterprise COBOL for z/OS Programming Guide)
Common interfaces and conventions (z/OS Language Environment Vendor Interfaces)

End of change