Midrange News for the IBM i Community


Posted by: seewiz
Multiple member file and record locks
has no ratings.
Published: 10 Jan 2013
Revised: 23 Jan 2013 - 4111 days ago
Last viewed on: 26 Apr 2024 (4456 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Multiple member file and record locks Published by: seewiz on 10 Jan 2013 view comments(6)

Our BOM is a multiple member file.  A new member is downloaded every night.  We have a program that when the users are ready, they can make the new member the "current" member.  All the other programs that access this file use the "current" member in the processing.  The only programs that open this file with an update/add are the programs related to making the new member current. 

We have many other programs that access the BOM through embedded SQL or regular file specs of IF not UF.

The other programs lock the BOM so we cannot change the current member when other people are in these programs. 

Is there anyway around this problem?  We are running into the problem of having too many people accessing the BOM during the time the users need to make the BOM current.

 

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: DaleB
Premium member *
Reading, PA
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 21 hours 40 minutes ago

The OS doesn't support a "current" member. If you have multiple members, and don't do an override when you open the file, you get the first member, which is the oldest member by create date.

What is involved in making the new member the "current" member? How do other programs select the "current" member when they open the file?

Posted by: seewiz
Premium member *
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 20 hours 57 minutes ago

The name of the file is PFBOM.  When a new member is downloaded at night, the member name is BOM_current days date (BOM_011013).  When we want to make it current, it copies the member selected (in this case BOM_011013) to PFBOM.  All the programs reference PFBOM, not the individual member names.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 20 hours 55 minutes ago
Edited: Thu, 10 Jan, 2013 at 11:54:25 (4124 days ago)

seewiz, since you quoted the word "current" I'm assuming you mean you have a routine that does an OVRDBF MBR(xxxx) where "xxxx" becomes what you call the "current" member... So SQL and RPG would use this "current" member. Have I got that right?

If so, then if another program has member xxxx opened for Update there is No reason you can't add another member to the file and/or do an override to another member. Probably what's happening is your "change current member" routine is opening the current, "current" member and then trying to change (do another override) the current member.

But since the first one is locked, and it wants to open it for update too, you can't. So you may have to change your routine so that it changes the current member by opening the file for IF (input only).
 Otherwise you'll need to include the SHARE parameter on the OVRDBF command used elsewhere.

[EDIT: Okay, that was my first thought--that you were copying the data to the "first" member. Ya, you're screwed. If the current member is opened for update, you're not going to be able to copy the data to it--replacing it.]

Posted by: seewiz
Premium member *
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 20 hours 48 minutes ago

Most of the programs accessing PFBOM (member PFBOM), is opening the file for IF.  The only programs that update the BOM are the ones to copy the new member to the PFBOM member.  There are a few that are using SQL, but I didn't think SQL would lock the file either.

Posted by: bobcozzi
Site Admin ****
Chicagoland
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 20 hours 26 minutes ago

If the SQL is updating the file, sure it would issue a lock.

Posted by: seewiz
Premium member *
Comment on: Multiple member file and record locks
Posted: 11 years 3 months 15 days 20 hours 22 minutes ago

None of the SQL is updating the BOM.  And the programs in question don't update the BOM.  I am excluding the ones that do from this situation as there is nothing we can do about those.