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: 10293
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: 8132
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 editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts Multiple VSAM files single output fil... Mohan Kothakota DFSORT/ICETOOL 11 Wed Aug 09, 2017 7:57 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am


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