Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to put exclusive lock on a file in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Fri Jun 05, 2015 10:36 pm    Post subject: How to put exclusive lock on a file in Cobol
Reply with quote

I see there is something called "LOCK MODE IS EXCLUSIVE", but it gives me a INVALID keyword error on compiling . It would be of great help if someone could give a FILE-CONTROL section example of how to specify LOCK.

Code:

FILE-CONTROL.                                             
    SELECT IN-FILE  ASSIGN INPUTI FILE STATUS INP-STATUS. 
    SELECT PIPE ASSIGN PIPE                               
    ORGANIZATION IS LINE SEQUENTIAL                       
    ACCESS MODE IS SEQUENTIAL                             
    FILE STATUS PIPE-STATUS.                   


I want to keep a exclusive lock on the file PIPE until I close the same. [/code]
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10272
Location: italy

PostPosted: Fri Jun 05, 2015 10:38 pm    Post subject: Reply to: How to put exclusive lock on a file in Cobol
Reply with quote

just use DISP=OLD in the jcl.
Back to top
View user's profile Send private message
sudarshan.srivathsav

New User


Joined: 10 Jul 2012
Posts: 24
Location: USA

PostPosted: Fri Jun 05, 2015 10:47 pm    Post subject:
Reply with quote

Enrico,

I cannot do that , my output is a unix file as below, the DISP parameter cannot go with PATH, PATHDISP cannot understand OLD. Any other way in program to put exclusive lock on the UNIX file. Basically I am trying to avoid data comingle since another process is also writing data to this pipe, and sometime the data in the pipe gets corrupted.

Code:


//WWCSRSA  JOB CLASS=A,NOTIFY=&SYSUID,MSGCLASS=H,REGION=0M           
//         JCLLIB ORDER=WWCSRS.PROCLIB                               
//STEP1    EXEC PGM=WRITEPIP                                         
//STEPLIB  DD DSN=WWCSRS.PGMLIB,DISP=SHR                             
//PIPE     DD  PATH='/u/wwcsrs/.mfxsplunk',                         
//             PATHDISP=(KEEP,KEEP),                                 
//             FILEDATA=TEXT,DSNTYPE=PIPE,                           
//             PATHOPTS=(ORDWR,OCREAT)                               
//*INPUTI   DD  DSN=WWCSRS.SAMPLE.INPUT.FILE,DISP=SHR               
//INPUTI  DD *                                                       
JOSEPH SMITH        02506240                                         
JAMES JONES         12345678                                         
JOHN JACKSON        00987654                                         

Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sat Jun 06, 2015 12:15 am    Post subject: Reply to: How to put exclusive lock on a file in Cobol
Reply with quote

Can different JOBs not have different (hfs) names for the pipe?

One way, assuming that it is z/OS JOBs only causing this issue, is to make a // INCLUDE for your pipe definition, which also contains a z/OS dataset with DISP=OLD. The additional dataset will provide the "locking" by not allowing another JOB to be selected whilst another JOB is already running.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8086
Location: East Dubuque, Illinois, USA

PostPosted: Sat Jun 06, 2015 3:52 am    Post subject:
Reply with quote

Quote:
I see there is something called "LOCK MODE IS EXCLUSIVE", but it gives me a INVALID keyword error on compiling
Which Enterprise COBOL manual did you find this in? LOCK MODE is used in a number of COBOL versions, but as far as I am aware it is not available for z/OS Enterprise COBOL.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP xls file from Mainfrmae kumarsatheeshc1 TSO/ISPF 5 Tue Jun 20, 2017 6:56 pm
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts XML Parse for large file muralikrishnan_new COBOL Programming 3 Mon Jun 12, 2017 12:50 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us