Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COBOL WORKING /LOCAL-STORAGE, reentrancy, CICS 1

Status
Not open for further replies.

yuriyking

Programmer
Jan 29, 2004
26
DE
Hi all.
I’m new to COBOL and I came from C/C++.
My question is: what is the difference between
LOCAL-STORAGE SECTION and WORKING-STORAGE SECTION.
As I understood, in terms of C, LOCAL-STORAGE SECTION – automatic storage class(stack), WORKING-STORAGE SECTION – static storage class. Am I right?

If yes, my next question:
A COBOL program for CICS should be at least quasi-reentrant in order to run correctly from several transactions concurrently.
If I compile/link-edit COBOL program without RENT option and I did not provide quasi-reentrancy in it (for example, I modify WORKING-STORAGE between two EXEC CICS calls) then I can get inconsistent concurrent execution.
I was almost sure about it before I read:

“Multithreading requires that all CICS application programs be reentrant; that is, they must be serially reusable between entry and exit points. CICS APPLICATION PROGRAMS USING THE EXEC CICS INTERFACE OBEY THIS RULE AUTOMATICALLY. For COBOL, C, and C++ programs, reentrancy is ensured by a fresh copy of working storage being obtained each time the program is invoked.”

Does it mean that I may to compile COBOL program without RENT option even if it modifies WORKING-STORAGE between two EXEC CICS calls?
Does it mean that COBOL program has its own copy of WORKING-STORAGE for every concurrent running transaction?
What about C? Does it mean that C program has its own copy of static storage for every concurrent running transaction?

Thanks.
P.S. I have posted this topic in CICS forum also.
 
Considering I have RELOAD(NO) in CICS program definition.
 
If you compile your COBOL program with the RENT compiler option (not the link-edit option), the compiler will AUTOMATICALLY create fully-reentrant code - even if you "modify" items in Working-Storage.

YOu only need to use Local-Storage for programs with RECURSIVE attribute in the Program-Id paragraph. *NOT* something that is very likely in a CICS environment (where "pseudo-conversational" applications are usually used.

Bill Klein
 
Hi WMK.
It is still unclear whether I may to compile COBOL program without RENT option.
Does it mean that such a program (non RENT) has its own copy of WORKING-STORAGE for every concurrent running transaction?

Thanks.
 
The Cobol Manual states:

CICS: You must use RENT for programs to be run under CICS.

I do not think you have an option here. You must compile under RENT for CICS. Why would you want to compile with NORENT?

etom
 
If you are trying to retain values in your Working Storage between calls to your module, you might try defining a save area in the root module of the call chain and pass the save area in linkage so the data is actually retained in the root module for the full lenght of a transaction. If you are trying to save data from one transaction to another, you will have to store it in a Database, hide it on a screen or some other technique that will hang around from one transaction to another.

Not real sure what it is you are trying to accomplish.

etom
 
The RENT compiler option determines what happens "under the covers" (and must NOT be confused with the RENT link-edit attribute).

RENT is a required compiler option for CICS programs (and is optional for non-CICS programs).

The fact that Working-Storage items "maintain" their LAST USED STATE between calls is part of the language definition and is true of both RENT and NORENT programs. (HOW this is done for RENT programs is the "compilers problem" - not the application programmers problem).

Local-Storage items are obtained in initial state for every "instance" of a program. When this happens is more complex - but again depends on the SYMATICS of COBOL and not on compiler options or whether or not you are running under CICS.

You ask,
"Does it mean that such a program (non RENT) has its own copy of WORKING-STORAGE for every concurrent running transaction?"

The answer is YES, but I don't know WHY you care.

Are you trying to find out HOW to "share data" across SEPARATE copies of the same transaction? If so, CICS provides facilities for that - but it is NOT via COBOL Working-Storage, Local-Storage - but via CICS facilities.


Bill Klein
 
Hi all.
Why am I trying to understand it:
my new employer has a couple of CICS ESA V4R1 application programs, and they neither have RENT link/edit atribute nor were compiled with RENT compiler option.
And now I'm just trying to understand whether (and how) all this stuff can work correctly.
I believe one way to make it working correctly is to specify RELOAD(YES) in CICS program definition.
But, if I have RELOAD(NO), how can COBOL not reentrant program have own copy of WORKING STORAGE?
That's it.
Thanks for help.

 
What compiler was used? With the "old" OS/VS COBOL compiler, there was NO "rent" compiler option - and serially reusable was what was used.

With current COBOLs (VS COBOL II and later) and current CICS TS (any release), you will get a run-timne ERROR if there is an attempt to "start" a NORENT (compiled) COBOL program.

Bill Klein
 
Compiler:
IBM COBOL for MVS and VM 1.2.2
It accept RENT option.

CICS:
CICS/ESA V4R1
 
See:

which says (in part),

"Language Environment issues message IGZ0018S when it detects a VS COBOL II program that was compiled with NORENT running on CICS. If you are developing on VS COBOL II without PN65736 applied, Language Environment will terminate your VS COBOL II applications run on CICS if they were compiled with NORENT."

Bottom-Line (once more),
Thous SHALT NOT try to run NORENT COBOL programs under CICS. If they work today, they may not tomrorrow - and they are not now, were never, and will never be SUPPORTED by IBM.

Bill Klein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top