Does CICS takes care of open/close of files?

Customer Information Control System. Middleware and MQ Series.
Previous topicNext topic

Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Does CICS takes care of open/close of files?

Post by RaOne » Mon Jun 27, 2016 3:11 pm

Hi,

While testing a CICS program I seem to make a conclusion and seek help to see if it's correct.If a file has been defined in file control table of CICS then, it looks like, it does not need to be opened explicity. Is this assupmtion correct?  Actually, I have noticed that the CICS program does not open the file explicitly if the file has a FCT entry.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Does CICS takes care of open/close of files?

Post by Robert Sample » Mon Jun 27, 2016 7:05 pm

CICS handles all file opens and closes.  So your CICS COBOL program, for example, will not have a SELECT nor an FD nor OPEN or CLOSE verbs for any files.




Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: Does CICS takes care of open/close of files?

Post by RaOne » Tue Jun 28, 2016 5:28 pm

Robert Sample wrote:CICS handles all file opens and closes.  So your CICS COBOL program, for example, will not have a SELECT nor an FD nor OPEN or CLOSE verbs for any files.
That I understand that CICS program will not have SELECT, FD, OPEN and CLOSE. What I was asking is when I was debugging there will be CALL to open a file in multiple executions. But it looks like that CCIS check if the file was open nad stil available before issuing the OPEN and does not make an OPEN request explictly.



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Does CICS takes care of open/close of files?

Post by Robert Sample » Tue Jun 28, 2016 6:31 pm

CICS has two options for file open -- at CICS start up or at first reference.  Once opened, the file will remain open until CICS shuts down, or the file is explicitly closed by a program, or a user closes it via the CEMT command.  You will not see any file opens or closes while debugging.




Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: Does CICS takes care of open/close of files?

Post by RaOne » Tue Jul 05, 2016 12:20 pm

Robert Sample wrote:CICS has two options for file open -- at CICS start up or at first reference.  Once opened, the file will remain open until CICS shuts down, or the file is explicitly closed by a program, or a user closes it via the CEMT command.  You will not see any file opens or closes while debugging.
Thanks for the confirmation. That's what I have observed but was not able to prove it with some reference document...



User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1379
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

Re: Does CICS takes care of open/close of files?

Post by Robert Sample » Tue Jul 05, 2016 6:48 pm

The manual is CICS Configuring
and the wording is
CICS allows or denies access to data in a file, depending on whether the state of the file is ENABLED. An enabled file that is closed is opened by CICS automatically when the first access request is made. The file remains open until an explicit CLOSE request or until the end of the CICS job.

You can also open a file explicitly by using either of the commands

Code: Select all

CEMT SET FILE(filename) OPEN
EXEC CICS SET FILE(filename) OPEN
When you use one of these commands, the file is opened irrespective of whether its state is enabled or disabled. You may choose this method to avoid the overhead associated with opening the file being borne by the first transaction to access the file.
You can also specify that you want CICS to open a file immediately after initialization by specifying the RDO OPENTIME(STARTUP) attribute (or the FILSTAT=OPENED parameter in the DFHFCT macro). If you specify that you want CICS to open the file after startup, and if the file status is ENABLED or DISABLED, the CICS file utility transaction CSFU opens the file. (CSFU does not open files that are: defined as UNENABLED the status of these remains CLOSED, UNENABLED.) CSFU is initiated automatically, immediately before the completion of CICS initialization. CICS opens each file with a separate OPEN request. If a user transaction starts while CSFU is still running, it can reference and open a file that CSFU has not yet opened; it does not have to wait for CSFU to finish.




Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: Does CICS takes care of open/close of files?

Post by RaOne » Thu Nov 16, 2017 9:32 pm

Thanks Robert.



Previous topicNext topic

Return to “CICS, Middleware and MQ Series.”