Page 1 of 1

open and close file in CICS.

Posted: Tue Dec 22, 2015 11:58 am
by Careesma L
I faced this interview questions. Please share your thoughts/answer on this:

Why don't CICS provides file open and close like in COBOL?

I answered that at the time when CICS region goes up, it will open all the files. We can change that using CEMT I FILEName. But I think I was not able to give a good answer. And that guy was not satisfied with my explanation. Can anyone here advise me with a good answer.

Re: open and close file in CICS.

Posted: Tue Dec 22, 2015 6:33 pm
by Robert Sample
CICS handles files as a resource available to every program, not just the one program. As such CICS handles file opens and closes -- you can specify to open the file when CICS comes up or on first reference. You don't put file definition and open / close logic in a CICS program first because CICS is handling them, and second because file open and close logic involves operating system functions that would interfere with the way CICS works.

Re: open and close file in CICS.

Posted: Mon Dec 28, 2015 2:26 pm
by Careesma L
Robert Sample wrote:CICS handles files as a resource available to every program, not just the one program. As such CICS handles file opens and closes -- you can specify to open the file when CICS comes up or on first reference. You don't put file definition and open / close logic in a CICS program first because CICS is handling them, and second because file open and close logic involves operating system functions that would interfere with the way CICS works.
Thanks Robert.

Can you please elaborate on this: second because file open and close logic involves operating system functions that would interfere with the way CICS works?

Re: open and close file in CICS.

Posted: Mon Dec 28, 2015 6:26 pm
by Robert Sample
If you compile a batch COBOL program with file opens and closes, then look at the generated pseudo-assembler code, you will see an OPEN generates an SVC 13 and a CLOSE generates an SVC 14. These are Supervisor Calls to operating system routines. When I was learning CICS, I was told that CICS will not function properly if SVC calls are made not under its control -- potentially even bringing down the entire region.

Re: open and close file in CICS.

Posted: Tue Dec 29, 2015 1:54 pm
by Careesma L
oh...ok. Thanks for your help Robert.