Hello
I've learned how to develop with COBOL in a big company (COBOL 85). It isn't real COBOL, because we have to use a framework for things like file or error handling. It simplifies many things, but I've never learned how to develop with real COBOL because of that. I noticed that we have in some of our programms a caching mechanism and I couldn't figure out how and why it works. The pattern is really simple: Check with a flag at the beginning of the programm if it is called the first time. If the flag is set to true, then do a SQL, store everything in the working-storage area and return the data. If the flag is set to false (=not the first call), return the data from the working-storage area. My colleagues could only tell me, that the memory stays allocated for a CICS transaction until the end. The memory allocation of the last call is used, if the same programm is called again and it is therefore important to initialize everything.
My question is why it uses the same memory allocation and why it doesn't deallocate the memory if it isn't used anymore. Is this normal in COBOL? I was shocked to hear that as former JAVA developer. I would expect atleast a new memory allocation for every call.
Example if it isn't clear: Programm A calls programm B. Progamm B calls programm D which executes a SQL and stores everything. Programm B is finished and Programm A calls now Programm C. Programm C needs the same information as Programm B and calls Programm D. Programm D knows that this is not the first call because of a flag and returns the stored data from the last call. Programm C finishes and Programm A also.
As you might have noticed, English isn't my first language. Please ask if something is unclear.
Cheers