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: 10242
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: 7314

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: 8035
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 Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Need help in reading and validating a... ABINAYATHULASI COBOL Programming 8 Tue Apr 18, 2017 11:42 am


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