Bernd has already started the reply, but I would like to add a little bit.

(First, I should say that most of this stuff IS documented in the PG and MG, 
but...)

To find a specific W-S variable, you will need a listing.  

If you start with a dump, you will find a stack frame for your COBOL program 
and in its register save area, you will find the CAA Anchor in GPR12.  Think of 
the CAA anchor as a thread specific piece of data.  Fortunately, most non OO 
COBOL programs are single threaded so you don't have to worry about that 
subtlety.

Also, if you start with a dump, you'll find the entry point for the COBOL 
program.  From this, you can find the PPA1  (there is one for every sub routine 
in a compilation unit -- using C terminology):

     000000                     000002            PROC    PGG1
     000000  47F0 F014          000002            BC      R15,20(,R15)          
#  Skip over constant area
     000004  01C3 C5C5          000002            DC      X'01C3C5C5'           
#  Eyecatcher: CEE
     000008  0000 0200          000002            DC      X'00000200'           
#  Stack Size
     00000C  0000 0690          000002            DC      X'00000690'           
#  Offset to PPA1     <<------
     000010  47F0 F001          000002            BC      R15,1(,R15)           
#  Wrong Entry Point: cause exception

from the PPA1, you can find the PPA2 (there is one for the entire compilation 
unit -- again C terminology):
                    PPA1:  Entry Point Constants
  000690  1CCEA506                                               =F'483304710'  
    Flags
  000694  00000850                                               =A(PPA2-PGG1)  
  <<--------
  000698  000007C0                                               =A(PPA3-PGG1)

from the PPA2, you can find the PPA4 (again only one):
                     PPA2:  Entry Point Constants
  000850  04002203                                               =F'67117571'   
    Flags
  000854  FFFFF7B0                                               
=A(CEESTART-PPA2)
  000858  00000058                                               =F'88'         
    A(PPA4-PPA2)    <<-------
  00085C  FFFFFFB0                                               
=A(TIMESTMP-PPA2)
  000860  FFFFF7B0                                               
=A(PrimaryEntryPoint-PPA2)
  000864  02200000                                               =F'35651584'   
    Flags

The C_WSA is actually the combined writeable static area for all of the 
programs bound into your module (or DLL).  To find the entire C_WSA for the 
module, you need to get the CEECRENT pointer out of the CEE Anchor.  That 
means, getting 500(GPR12).  Now you need to find the bit of the C_WSA for this 
particular program (compilation unit in C terminology).  You can get that from 
the PPA4:
                     PPA4:  Entry Point Constants
  0008A8  08000000                                               =F'134217728'  
    Flags 1
  0008AC  00020100                                               =F'131328'     
    Flags 2
  0008B0  00000000                                               =F'0'          
    A(NORENTstatic)
  0008B4  00000000                                               =F'0'          
    Q(RENTstatic)    <<-----

Add that QCON to the CEECRENT -- 500(GPR12) --  and you have the start of the 
section of the WSA for your program.

Now you need to know if WSOPT was used or not.  For that you need to go back to 
the PPA2 and find the timestamp:
  000844  FFFFFFB0                                               
=A(TIMESTMP-PPA2)

The time stamp is a fixed length and immediately following it is :
                    Compiler Options and Program Information Section
  000814         0034                                            =X'0034'       
    Size of Compiler Options and Prog Info Section
  000816  (+00)  0474                                            =X'0474'       
    UNSIGNED BINARY CODE PAGE CCSID VALUE
  000818  (+02)  07                                              =X'07'         
    ARCHITECTURE LEVEL
  000819  (+03)  00                                              =X'00'         
    OPTIMIZATION LEVEL
  00081A  (+04)  1406                                            =X'1406'       
    INFO. BYTES 28-29
  00081C  (+06)  0000                                            =X'0000'       
    INFO. BYTES 30-31
  00081E  (+08)  A0C8754C2000                                    
=X'A0C8754C2000'   INFO. BYTES 1-6
  000824  (+14)  001000084001                                    
=X'001000084001'   INFO. BYTES 7-12

The bit you're looking for is bit 3 of byte 15.  Compare the output above to 
the same program with NOWSOPT
  00080C  (+14)  000000084001                                    
=X'000000084001'   INFO. BYTES 7-12

If you are using NOWSOPT (which is the default for V4) your W-S data items are 
all in your piece of the module's WSA.  To find a specific item, you need to 
consult the listing looking for this section:
                     * * * * *   S T A T I C     M A P   * * * * *

  OFFSET (HEX)   LENGTH (HEX)   NAME

If you are using WSOPT (which is the default in V6), there will be a pointer in 
the WSA that points to the working storage for your program.  That can also be 
found in the PPA4:
 0008B8  0000006C                                               =F'108'         
   A(DATA31_address_cell-RENTstatic)

So you find the WSA and go to (in this case) offset x'6C' and you will find a 
pointer to your working storage.  In this case, to find a specific data item, 
you need to consult the listing looking for this section:
                     * * * * *   W O R K I N G - S T O R A G E   M A P   * * * 
* *

  OFFSET (HEX)   LENGTH (HEX)   NAME

In both cases (WSOPT and NOWSOPT) the storage that you find (either C_WSA or 
the target of the pointer in C_WSA) will have both some compiler artifacts and 
actual working storage.  These artifacts also appear in the * * M A P * * 
sections mentioned above.  Working Storage is always contiguous.  If you don't 
have a listing file and you have gone through the procedure described above and 
you really want to identify only working storage (and not compiler artifacts) 
and you have V6.1 and you get the PTF that was shipped on May 8, there is a new 
addition to the end of PPA4:
 000880  002A                                                   =X'2A'          
   A(CUName-PPA4)
  000888  00000098                                               =X'98'         
    Offset UsrWrkStrg    <<-----
  00088C  0000003B                                               =X'3B'         
    Length UsrWrkStrg   <<-----
  000890  00                                                     =X'0'          
    Has Externals

These tell you exactly where in the storage that you found by following the 
process above user working storage starts and how much working storage there is.

Hmmm... looking back over this, it really couldn't be simpler. :-)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to