File NEED, PUT (Was: Update Out of Sync)

Darren Reely darren.reely@latticesemi.com
Thu, 14 Feb 2002 17:10:59 -0800


What I really wanted to know was...

If you place NEED on a file statement, is the PUT suppose to be executed
even when no data has been changed for the record?

In my case, I know the UPDATE procedure must be executed because User 2 did
make a change to the DETAIL record which does get updated properly.

Thanks,

Darren

P.S. This is not problem of two users updating simultaneously.  They have
fetched the identical record before the other person has done an update. 
But their updates could occur several minutes apart.


Darren Reely wrote:
> 
> Hi All,
> 
> I have a screen that two users can update fields from different records.
> Unfortunately we duplicate one of fields from the primary record to another
> table, but this can fail when two users are in the screen performing
> updates.
> 
> Here is the scenario.
>   User 1 & 2 both pull up the same data at the same time.
> 
>   User 1 changes a value in the primary record.
>   User 1 performs an update which does the 'put product_ms'.
>   User 1 update performs postupdate procedure to copy the column
>          to the other table.
> 
>   User 2 changes a value in a detail record.
>   User 2 performs an update, which skips the 'put product_ms' since
>          no fiels were changed for it.
>   User 2 update performs postupdate with old value that user 1 changed.
> 
>   The columns are now out of sync.
> 
> Refer to code below if needed.
> 
> Now for my question.  Why when I've added 'NEED 1' to the primary record,
> does the 'put product_ms' not get performed?  The proof is that the new
> value is still in the record after the second user has updated his 'pmy'
> record change.  I thought placing a NEED on a file statement forces an
> update.  Am I misunderstanding this.  No errors or warnings are returned.
> 
> I think my solution will be to check if the field in the primary record has
> changed. If so, only then do the update of the other table.  My other
> solution is to use a trigger.
> 
> System is:
>  PH 8.13.D1
>  Sun Solaris 2.6
>  Oracle Release 7.3.4.4.0.
> 
> file product_ms in mfg PRIMARY NEED 1
> file product_ms_yield in mfg alias pmy DETAIL occurs 2 noitems
> file tester_forecast_yield in mfg designer
> 
> procedure update
>  begin
>     put product_ms
>     for pmy
>         put pmy
> end
> 
> procedure postupdate
> begin
>   while retrieving tester_forecast_yield via prod_line, ms &
>        using prod_line, ms of product_ms
>     begin
>        let gross_die_waf of tester_forecast_yield = gross_die_waf of
> product_ms
>        put tester_forecast_yield
>     end
> end
> 
> Thank you for your time.
> 
> Darren
> 
> P.S.  The surprise is that this 5 year old bug (before my time) has only
> thrown out 11 records total this year and last.  Also lucky, is the small
> difference.
> 
> = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> Mailing list: powerh-l@lists.swau.edu
> Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
> Unsubscribe: "unsubscribe" in message body to powerh-l-request@lists.swau.edu
> http://lists.swau.edu/mailman/listinfo/powerh-l
> This list is closed, thus to post to the list you must be a subscriber.