That's actually a trickier question than you might imagine!  There are a number 
of cases:  the case where your module consists of COBOL, PL/I and assembler 
only and all other cases.  All other cases include cases where the COBOL run 
time support is implemented in a language other than the above.  These cases 
include OO COBOL, XML support and a few others.

In the second case (not pure COBOL), the C_WSA is loaded in exactly the same 
way as it is for a C program.  Basically, first the program is loaded and then 
the C run time gets control.  It determines that you want to start  new 
instance of this program (C_WSA is only used for RENT.)  So it calls CEEPPOS 
which is the actual routine that gets a WSA and initializes it.  This all 
happens before main is run.  (Or, in the case of C++, before any file scope 
statics are constructed.)

In the first case, your program starts and the COBOL bootstrap routine gets 
control.  That routine is called at the start of every PROGRAM.  In most cases, 
it checks a few things and returns.  But for the first program in the run unit, 
it does some work including ensuring that LE is up.  Part of that work is 
getting storage for the WSA.   All of this happens before the first user 
statement in the PROCEDURE DIVISION is executed.

So, no matter how the C_WSA is loaded (by and LE routine or by the COBOL run 
time) it is present before the first user written statement in the program is 
executed.  Which means that unless you're getting some sort of a trap during 
the COBOL start up, you should always see the C_WSA somewhere in your storage.

By the way, WORKING STORAGE is another area of complexity.  In the case of 
NOWSOPT (the default for V5) W-S items are directly in the C_WSA.  In the case 
of WSOPT (V6) W-S is separately allocated and the WSA contains a pointer to 
that allocation.  (Again, this is all done before the first user statement is 
executed.)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to