IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to read a file in parallel using COBOL program?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Thu Mar 28, 2013 9:42 am
Reply with quote

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
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Mar 28, 2013 10:29 am
Reply with quote

Hi - What is the access type for file or what kind of file you're referring here?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Mar 28, 2013 2:57 pm
Reply with quote

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
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Thu Mar 28, 2013 3:39 pm
Reply with quote

thanks a lot for your quick response icon_smile.gif

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 28, 2013 4:40 pm
Reply with quote

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
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Fri Mar 29, 2013 5:52 am
Reply with quote

OK, thanks a lot Robert, I will first have a test on it
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Fri Mar 29, 2013 10:35 am
Reply with quote

haohao wrote:
it doesn't matter use PS file or Vsam file, both are OK.
icon_confused.gif 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
View user's profile Send private message
haohao

New User


Joined: 23 May 2008
Posts: 35
Location: beijing China

PostPosted: Fri Mar 29, 2013 11:03 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 29, 2013 6:51 pm
Reply with quote

Hello,

Yup, exactly as intended. . .
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Fri Mar 29, 2013 7:16 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top