1. If I am calling BATCH programs from CICS Programs (and I have read the IBM RED BOOKS safe thread document and still trying to read all 378 pages of it) where does CICS get the storage for working storage for the CALLed or BATCH program as CICS will definately not do a GETMAIN for the working storage. What does CICS do when the CALLed program CALLs another BAtch program .
2. Do I have to initialise every field in working storage at the top of the CALLed program to be safe?
3. Is the CALLed program enq'd so that only one txn task goes through the pgm at once or is it allowing multiple tasks to execute the same CALLed module at the same time hence potenitlaly causing data integrity problems?
4. IS the working storage after the CALL clean or as it was hence availab le for the next task to use and the working storage values are left as the CALLed program exited I assume they are not released as the .
5. the BATCH programs are linked as REUSE but no RENT but the CICS programs are LINK as NOT RENT and NOT REUSE. I have checked the objects using IEHLIST and expanded the BIT MAP.
6. All the programs reside in ESDSA. I cannot see why the CICS program is not in ERDSA except for the fact it is not RENT and REUSE in the LINK and REUSE in the compile option.
7. how many LEVELS of CALL can I go down before I have problems?
Joined: 06 Jun 2008 Posts: 8201 Location: Dubuque, Iowa, USA
I've read your post several times and I'm confused. What, exactly, are you attempting to do? How does threadsafe figure into that? For example, you say
If I am calling BATCH programs from CICS Programs
and this doesn't make sense -- if a program is called from CICS it is a CICS program, whether or not there are any CICS API calls in the program. Batch programs use facilities (such as FD statements, OPEN, READ, WRITE, CLOSE in COBOL) that cause abends in CICS when invoked.
Threadsafety is nothing more or less than a method of ensuring that CICS transactions can run on multiple processors without causing race conditions, lockouts, or other bad things. It has nothing to do with batch programs.
And why would you be concerned about where CICS stores things in memory? Let CICS do its thing, you do the application programming, and let the world be happy.
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
If you're concerned about WS being initialized each time the sub-program is invoked, code "PGMNAME" IS INITIAL.
Note that INITIAL only works against VALUE clauses. If there are fields without a VALUE clause, then these would need to be initialized manually.
The only issue you will have with a Threadsafe program calling your sub-program is a STATIC call, which I wouldn't recommend. Even though the NODYNAM option is required in CICS, a Dynamic Call in CICS is by virtue of a CALL "VARIABLE". A CALL "LITERAL" will be STATIC.
However (ambivalence aside), STATIC CALLS can work in Threadsafe environments, providing that you pass reusable WS from the Caller or use EXTERNAL WS, known throughout the run-unit. Passed WS and EXTERNAL WS must be manually initialized, regardless whether the call is DYNAMIC or STATIC.