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: 10202
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: 7225

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: 7908
Location: Bellevue, IA

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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


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