open and close file in CICS.

All sort of Mainframes Interview Questions.
Post Reply
Careesma L
New Member
Posts: 3
Joined: Mon Jan 19, 2015 9:44 am

open and close file in CICS.

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: open and close file in CICS.

Post 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.
Careesma L
New Member
Posts: 3
Joined: Mon Jan 19, 2015 9:44 am

Re: open and close file in CICS.

Post 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?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: open and close file in CICS.

Post 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.
Careesma L
New Member
Posts: 3
Joined: Mon Jan 19, 2015 9:44 am

Re: open and close file in CICS.

Post by Careesma L »

oh...ok. Thanks for your help Robert.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”