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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REENTRANT PROGRAM

Status
Not open for further replies.

sganti

Programmer
Nov 20, 2002
10
0
0
HK
Hello,
I am reading "CICS HAND BOOK" by Mr.Kageyama.
In that book, it is specified that:
"The REENTRANT program must not alter the program itself".
I could not understand this point.

Can you please explain me how a program logic can be modified by itself? Please.. any example is also ok for me.
I am getting this point.Please I request you.

Thanks,
Sri
 
I am also finding problem in understanding what exactly is Reentrant Program, and what is meant by saying "the program cannot modify itself". Can someone explain it with some other example.


 
Hey Arfi, A re-entrant program is one whose executable code can be run by many tasks at the same time. Due to that fact, the storage associated with the executing program cannot be modified. This is handled in CICS by compiling the COBOL program with the RENT option. This causes code to run when the program initially loads at task start that will issue a GETMAIN for storage, put the pointer for it in a CICS Table (probably the Task Control Table or one of its sub-tables), initialize all the Value clauses from the Literal Pool with a series of MVC (Move Characters) Assembler instructions, then finally give control to the first Verb in the code. Each task running the program will have its own storage getmain'ed, so when the program modifies it, it won't affect the storage of the other executions of the program.

Even command-level Assembler programs do a getmain at startup.

Hope this helps.
 
Hi,

As far as my knowledge goes using the ALTER command in COBOL the program can modify the source code.

Any such program written that would modify its own code should not be used under CICS environment.

hope this helps.

Rajesh
 
Sri

There is a special level of hell reserved for people who use ALTER, and write self-modifying code in general. This might have been deemed acceptable behaviour back in the days when mainframe programs had to run in 6K of storage or less, but these days it is inexcusable.

You can ensure that this can't happen by compiling with RENT, and linking with RENT,REUS. If you have storage protection turned on in CICS (and you should, even if you don't use transaction isolation) then CICS will load your program into either the ERDSA or RDSA. This is key-zero storage and any attempt to write to it by anyone not running in supervisor state will cause an ASRA(S0C4)

Steve
 
Actually having STGPORT=ON won't cause CICS to load reentrant programs into RDSA or ERDSA. This will simply separate and protect CICS Key storage from USER Key storage. If on the other hand you set RENTPGM=PROTECT, then programs marked as RENT by the linkage editor are eligible to be loaded into RDSA or ERDSA (even if the program is not really reentrant). If this occurs then as the program tries to update its own storage it will crash and burn with a protection exception.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top