View previous topic :: View next topic
|
Author |
Message |
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
Hello all,
there is a scenario that need to read a file in parallel with cobol program.
If a file is already be opened and written info into it by one process, just like a system log file, is it possibol to open that file by another cobol batch program in share mode?
I just did a test, the batch job was hanging with a message of waiting for data set.
do you have the same requirement ever before? and does it can be achieved by any workaround? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi - What is the access type for file or what kind of file you're referring here? |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
If the file is a sequential file then the program writing to it should have a DISP of NEW or OLD. Either implies exclusive use so another program cannot SHR. If the file is VSAM, on the other hand, it will depend on the share options specified for the VSAM file. |
|
Back to top |
|
|
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
thanks a lot for your quick response
it doesn't matter use PS file or Vsam file, both are OK.
If use VSAM file, how to set the share optioin? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You don't -- or at least should not -- determine VSAM file share options based upon a single situation; you must look at how the file is being used by the entire application. Depending upon the site standards and the application and the experience level of the developer, any SHROPTION (2,3) or (3,3) or (4,3) might be appropriate. |
|
Back to top |
|
|
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
OK, thanks a lot Robert, I will first have a test on it |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
haohao wrote: |
it doesn't matter use PS file or Vsam file, both are OK. |
if so, what you experimented with intially
Quote: |
I just did a test, the batch job was hanging with a message of waiting for data set. |
|
|
Back to top |
|
|
haohao
New User
Joined: 23 May 2008 Posts: 35 Location: beijing China
|
|
|
|
I just tested with a PS file, first use edit mode open it in ISPF, and let another batch job open it with DISP=SHR mode. under that circumstance the batch job pending with waiting for data set. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yup, exactly as intended. . . |
|
Back to top |
|
|
Ed Goodman
Active Member
Joined: 08 Jun 2011 Posts: 556 Location: USA
|
|
|
|
We have a system in place that lets programs each create their own flat file of messages. Then, at the end of batch, we gather them and copy them into a single file.
This is important for handling problems where a job abends and needs to restart. Any log messages since the last commit need to come out, so we can't share the files. |
|
Back to top |
|
|
|