Problem with (shared) record buffers

Vaalen

Member
Hi all,

We are working on linux, chui, OE 10.2A.
Ever since september we are having strange problems.

When we are making invoices (end of the day) we read all orders, order lines and everything we need in a FOR EACH loop. This has worked nicely and hasn't changed.
Every now and then the record buffer of the order line seems to be empty, or partly empty. When I reread the record, it seems to be oké.

It does not make any sense to me that a record satisfied the FOR EACH conditions and appears to be empty, or partly empty.
The buffers for order and order line are shared buffers with the same name as the db record (do not ask me why, I do not know).

Is there anybody familiar with this kind of problem?

Thanks in advance.
 

TomBascom

Curmudgeon
An actual code sample would be helpful.

Lacking that it sounds like you are simply seeing the results of a dirty read. Records read NO-LOCK can satisfy the WHERE clause so long as the index fields match the criteria but they may not be completely updated if the update is in many statements (rather than a single ASSIGN).
 

Vaalen

Member
Hi Tom,

Thanks for your reply. The first thing we ruled out is the possibility that other users/processes are currently updating records we do not want to be updated at this time.
I included the main FOR EACH loop, from where our invoicing starts. The problem is with table xrvorre. Alle tables are shared buffers with the same name as the tables, except for wfvpref, which is a workfile (sorry, ancient coding), afnemer, landafnemer, landverzend en betaaldebiteur. These are shared also, but have different names.

When I look in our auditing data I can see the values for the xrvorre should be correct, and were last updated somewhere in the afternoon, hours before invoicing. Most of the xrvorre's (orderlines) are fine, just some, we can see no pattern here, differ from what is expected. I was wondering if there could be a resource problem of any kind.

What we introduced since september is the use of pdf-include, which we found in de OpenEdge hive. This performs well and seem to have no problems. Should you need any more information, please tell me.

Thanks for your time. I appreciate it.


Code:
FOR      xbfil NO-LOCK
   WHERE xbfil.rbvnr EQ filreg#,
   FIRST xbkal NO-LOCK
   WHERE xbkal.rbvnr EQ xbfil.cbasi
     AND xbkal.ddatu GE faktdate#,
   FIRST xbjnb NO-LOCK
   WHERE xbjnb.rbvnr EQ xbfil.cbasi,
   FIRST xbpar NO-LOCK
   WHERE xbpar.rpara EQ "PARM",
   FIRST xbdag NO-LOCK
   WHERE xbdag.rbvnr EQ xbfil.cbasi,
   FIRST mbdag NO-LOCK
   WHERE mbdag.rc_filbas EQ xbfil.cbasi,
    EACH wfvpref NO-LOCK
   WHERE wfvpref.rc_regfil EQ xbfil.rbvnr
     AND wfvpref.rc_vpref  GE rpreffr#
     AND wfvpref.rc_vpref  LE rprefto#
 
    DO TRANSACTION:
    FOR EACH xrvor NO-LOCK
       WHERE xrvor.rbvnr   EQ xbfil.rbvnr
         AND xrvor.rpref   EQ wfvpref.rc_vpref
         AND xrvor.rordn   GE rordnfr#
         AND xrvor.rordn   LE rordnto#
         AND xrvor.cverz   GE cverzfr#
         AND xrvor.cverz   LE cverzto#
         AND xrvor.rords   GE rordsfr#
         AND xrvor.rords   LE rordsto#
         AND xrvor.radrebd GE radrefr#
         AND xrvor.radrebd LE radreto# /*xbafn.radre*/ /* 34155 */
         AND (INT(xrvor.fgere) + INT(fbalie#) NE 0)
         AND xrvor.fbusy   EQ FALSE
         AND xrvor.fblok   EQ FALSE
         AND xrvor.ffakt   EQ TRUE
         /* -----------------------------------------------------------------
         CA 28906 Controle op verplichte controlestap ivm rechtsreekse orders
         ----------------------------------------------------------------m */
         AND NOT CAN-FIND (FIRST xrvot
                           WHERE xrvot.rbvnr EQ filreg#
                             AND xrvot.rmodu EQ 'XV'
                             AND xrvot.rtras EQ 'VERK'
                             AND xrvot.rpref EQ xrvor.rpref
                             AND xrvot.rordn EQ xrvor.rordn
                             AND xrvot.fverp EQ TRUE
                             AND xrvot.fstap EQ FALSE
                             USE-INDEX xrvot),
       /* dit lijkt me de goede plek om xbafn op te halen */
       FIRST xbafn NO-LOCK
       WHERE xbafn.rbvnr EQ xbfil.cbasi
         AND xbafn.radre EQ xrvor.radrebd,
       FIRST xbors NO-LOCK
       WHERE xbors.rbvnr EQ xbfil.cbasi
         AND xbors.rords EQ xrvor.rords
         AND xbors.fexp  EQ FALSE,
       FIRST xbbek NO-LOCK
       WHERE xbbek.rbvnr EQ xbfil.cbasi
         AND xbbek.rbeta EQ xrvor.rbeta,
       FIRST xrvorve NO-LOCK
          OF xrvor,
       FIRST xbval NO-LOCK
       WHERE xbval.rbvnr EQ xbfil.cfina /* xbfil.cbasi */
         AND xbval.rvalu EQ xrvor.rvalu,
       FIRST betaaldebiteur NO-LOCK
       WHERE betaaldebiteur.rbvnr EQ xbfil.cbasi
         AND betaaldebiteur.radrg EQ "AFNR"
         AND betaaldebiteur.radre EQ xrvor.radrebd
         AND betaaldebiteur.qadre EQ 0,
       FIRST afnemer NO-LOCK
       WHERE afnemer.rbvnr EQ xbfil.cbasi
         AND afnemer.radrg EQ "AFNR"
         AND afnemer.radre EQ xrvor.radre
         AND afnemer.qadre EQ  0,
       FIRST landafnemer NO-LOCK
       WHERE landafnemer.rbvnr EQ xbfil.cbasi
         AND landafnemer.rland EQ afnemer.rland,
       FIRST landverzend NO-LOCK
       WHERE landverzend.rbvnr EQ xbfil.cbasi
         AND landverzend.rland EQ xrvorve.rland,
        EACH xrvorre OF xrvor NO-LOCK
       WHERE xrvorre.cstatbe  EQ "J"
          OR xrvorre.cstatte  EQ "J"
          OR xrvorre.cstatko  EQ "J"
          OR xrvorre.cstatem  EQ "J"
          OR (xrvorre.cstatve EQ "J" AND xrvorre.qfakt NE 0)
       BREAK BY xrvor.radrebd
             BY xrvor.radre
             BY xrvor.rbeta   
             BY xrvor.rlandr  
             BY xrvor.rvalu   
             BY xrvor.rklas   
             BY betaaldebiteur.radre
             BY xrvor.cverz   
             BY xrvor.rpref
             BY xrvor.rordn
             BY xrvorre.rrgln :
 ...
    progA:     write down the contents of xrvorre. This, surprisingly lead us to believe that sometimes the contents is not what could be expected in the FOR EACH conditions.
…..
End.
 

TomBascom

Curmudgeon
What, exactly, do you mean by "shared buffer"? How are these buffers defined?

What version of Progress are you using?

Is it running client/server? If so are you using -rereadnolock?

How did you rule out the possibility that other users might be modifying data?

How does "progA" find xrvorre?
 

Vaalen

Member
the first line in the first message says: "We are working on linux, chui, OE 10.2A." ;)

definition of shared buffers:


Code:
DEF {&new} SHARED BUFFER xbfil       FOR xbfil.
DEF {&new} SHARED BUFFER xbkal       FOR xbkal.
DEF {&new} SHARED BUFFER xbjnb       FOR xbjnb.
DEF {&new} SHARED BUFFER xbpar       FOR xbpar.
DEF {&new} SHARED BUFFER xbdag       FOR xbdag.
DEF {&new} SHARED BUFFER mbdag       FOR mbdag.
/*DEF {&new} SHARED BUFFER xbafd       FOR xbafd.*/
DEF {&new} SHARED BUFFER xrvor       FOR xrvor.
DEF {&new} SHARED BUFFER xbbek       FOR xbbek.
DEF {&new} SHARED BUFFER xrvorve     FOR xrvorve.
DEF {&new} SHARED BUFFER xbval       FOR xbval.
DEF {&new} SHARED BUFFER afnemer     FOR xbnaw.
DEF {&new} SHARED BUFFER landafnemer FOR xblnd.
DEF {&new} SHARED BUFFER landverzend FOR xblnd.
DEF {&new} SHARED BUFFER betaaldebiteur FOR xbnaw.
DEF {&new} SHARED BUFFER xrvorre     FOR xrvorre.
DEF {&new} SHARED BUFFER xbafn       FOR xbafn.
DEF {&new} SHARED BUFFER xbafnio     FOR xbafn. /* 34155 */
/* xevzenr en xevzeno worden alleen gebruikt via pxft00e.p */
DEF {&new} SHARED BUFFER xevzenr     FOR xevzenr.
DEF {&new} SHARED BUFFER xevzeno     FOR xevzeno.
DEF {&new} SHARED BUFFER xrvzen      FOR xrvzen.
DEF {&new} SHARED BUFFER bprnt       FOR bprnt.
DEF {&new} SHARED BUFFER bprntx      FOR bprntx.

We are not running client/server.
-rereadnolock is not turned on.

We ruled out that possibility because our auditing data tells us so (progress auditing is on) and because there are no rollback messages in the .lg files, which could lead to a rollback of the auditing data. As a matter of fact, we depend on the reliablity of the auditing data.

Since xrvorre is shared, prog A does not read xrvorre, it simply uses the contents of the shared buffer.
 

TomBascom

Curmudgeon
So looking back at the code I notice that all of the tables are being found NO-LOCK.

But you have wrapped the whole thing in a TRANSACTION.

Why is that?

How does progA expect to update ("write down") these NO-LOCK records?

Roll backs do not always correspond to .lg file messages -- so that isn't really establishing anything.

This really "smells" a lot like dirty reads to me. If you are lucky maybe you can find all of the code that updates "xrvorre" and make sure that it only does so in a single atomic ASSIGN statement.
 

trx

Member
I am not sure whether this apply to your problem, but is somewhat similar.
I mentioned some time ago (http://www.progresstalk.com/showthread.php?117561-RELEASE-of-the-record) that sometimes buffers and temp-tables can cause unexpected behavior (Progress 10.1C04).

Code:
DEF TEMP-TABLE tt NO-UNDO LIKE _file.
DEF BUFFER bf FOR tt.

FIND FIRST _file NO-LOCK.

CREATE tt.
BUFFER-COPY _file EXCEPT _FILE-NAME TO tt.

/* RELEASE tt. */
/* FIND FIRST tt. */
/* tt._FILE-NAME = "xx". */


FIND FIRST bf. /* ERROR: ** FIND FIRST/LAST failed for table . (565)*/
If you uncomment one of commented statements (RELEASE, FIND, _FILE-NAME assignment) or enclose CREATE and BUFFER-COPY in transaction then everything works fine i.e. Progress is able to FIND FIRST bf without ERROR.
Please note, that FIND FIRST bf should work without any of those statements (if FIND FIRST tt works then why not FIND FIRST bf ?).
 

Vaalen

Member
Thank you for your replies.

Tom, xrvorre (the orderline) is deleted at the end of processing it.

Code:
  FIND xrvorre2 WHERE RECID(xrvorre2) = RECID(xrvorre) EXCLUSIVE-LOCK.
  DELETE xrvorre2.

There is never any TRANSACTION defined except for the FOR EACH loop. I honestly do not know why, this is ancient coding made before I even worked here.
There are about 20 to maybe 30 programs run from the main-loop, all including the shared buffers I listed, but doing nothing but read the contents.

Another program does this:
Code:
   FIND xrvor-b WHERE RECID(xrvor-b) = RECID(xrvor) EXCLUSIVE-LOCK.
   ASSIGN xrvor-b.avoorvv = 0
          xrvor-b.avoor   = 0.

xrvor are the orders themselves.

We log the contents of xrvorre by just dumping it to file at the moment.

We found another interesting thing, it might be coincidence, maybe not.

I changed the FOR EACH loop to use local buffers (bxrvor, bxrvorre, defined as local buffers).

Code:
DEFINE BUFFER bxrvorre        FOR xrvorre.
DEFINE BUFFER bxbfil          FOR xbfil.
DEFINE BUFFER bxbkal          FOR xbkal.
DEFINE BUFFER bxbjnb          FOR xbjnb.
DEFINE BUFFER bxbpar          FOR xbpar.
DEFINE BUFFER bxbdag          FOR xbdag.
DEFINE BUFFER bmbdag          FOR mbdag.
DEFINE BUFFER bxrvor          FOR xrvor.
DEFINE BUFFER bxbbek          FOR xbbek.
DEFINE BUFFER bxrvorve        FOR xrvorve.
DEFINE BUFFER bxbval          FOR xbval.
DEFINE BUFFER bafnemer        FOR xbnaw.
DEFINE BUFFER blandafnemer    FOR xblnd.
DEFINE BUFFER blandverzend    FOR xblnd.
DEFINE BUFFER bbetaaldebiteur FOR xbnaw.
DEFINE BUFFER bxbafn          FOR xbafn.

FOR      bxbfil NO-LOCK
   WHERE bxbfil.rbvnr EQ filreg#,
   FIRST bxbkal NO-LOCK
   WHERE bxbkal.rbvnr EQ bxbfil.cbasi
     AND bxbkal.ddatu GE faktdate#,
   FIRST bxbjnb NO-LOCK
   WHERE bxbjnb.rbvnr EQ bxbfil.cbasi,
   FIRST bxbpar NO-LOCK
   WHERE bxbpar.rpara EQ "PARM",
   FIRST bxbdag NO-LOCK
   WHERE bxbdag.rbvnr EQ bxbfil.cbasi,
   FIRST bmbdag NO-LOCK
   WHERE bmbdag.rc_filbas EQ bxbfil.cbasi,
    EACH wfvpref NO-LOCK
   WHERE wfvpref.rc_regfil EQ bxbfil.rbvnr
     AND wfvpref.rc_vpref  GE rpreffr#
     AND wfvpref.rc_vpref  LE rprefto#
                                :
  /* ----------------------------
     TRANSACTIE PER FACTUUR
  ---------------------------- */
    DO TRANSACTION:
    FOR EACH bxrvor NO-LOCK
       WHERE bxrvor.rbvnr   EQ bxbfil.rbvnr
         AND bxrvor.rpref   EQ wfvpref.rc_vpref
         AND bxrvor.rordn   GE rordnfr#
         AND bxrvor.rordn   LE rordnto#
         AND bxrvor.cverz   GE cverzfr#
         AND bxrvor.cverz   LE cverzto#
         AND bxrvor.rords   GE rordsfr#
         AND bxrvor.rords   LE rordsto#
         AND bxrvor.radrebd GE radrefr#
         AND bxrvor.radrebd LE radreto#
         AND (INT(bxrvor.fgere) + INT(fbalie#) NE 0)
         AND bxrvor.fbusy   EQ FALSE
         AND bxrvor.fblok   EQ FALSE
         AND bxrvor.ffakt   EQ TRUE
         /* -----------------------------------------------------------------
         CA 28906 Controle op verplichte controlestap ivm rechtsreekse orders
         ----------------------------------------------------------------m */
         AND NOT CAN-FIND (FIRST xrvot
                           WHERE xrvot.rbvnr EQ filreg#
                             AND xrvot.rmodu EQ 'XV'
                             AND xrvot.rtras EQ 'VERK'
                             AND xrvot.rpref EQ bxrvor.rpref
                             AND xrvot.rordn EQ bxrvor.rordn
                             AND xrvot.fverp EQ TRUE
                             AND xrvot.fstap EQ FALSE
                             USE-INDEX xrvot)
                             ,
       FIRST bxbafn NO-LOCK
       WHERE bxbafn.rbvnr EQ bxbfil.cbasi
         AND bxbafn.radre EQ bxrvor.radrebd,
       FIRST xbors NO-LOCK
       WHERE xbors.rbvnr EQ bxbfil.cbasi
         AND xbors.rords EQ bxrvor.rords
         AND xbors.fexp  EQ FALSE,
       FIRST bxbbek NO-LOCK
       WHERE bxbbek.rbvnr EQ bxbfil.cbasi
         AND bxbbek.rbeta EQ bxrvor.rbeta,
       FIRST bxrvorve NO-LOCK
          OF bxrvor,
       FIRST bxbval NO-LOCK
       WHERE bxbval.rbvnr EQ bxbfil.cfina
         AND bxbval.rvalu EQ bxrvor.rvalu,
       FIRST bbetaaldebiteur NO-LOCK
       WHERE bbetaaldebiteur.rbvnr EQ bxbfil.cbasi
         AND bbetaaldebiteur.radrg EQ "AFNR"
         AND bbetaaldebiteur.radre EQ bxrvor.radrebd
         AND bbetaaldebiteur.qadre EQ 0,
       FIRST bafnemer NO-LOCK
       WHERE bafnemer.rbvnr EQ bxbfil.cbasi
         AND bafnemer.radrg EQ "AFNR"
         AND bafnemer.radre EQ bxrvor.radre
         AND bafnemer.qadre EQ  0,
       FIRST blandafnemer NO-LOCK
       WHERE blandafnemer.rbvnr EQ bxbfil.cbasi
         AND blandafnemer.rland EQ bafnemer.rland,
       FIRST blandverzend NO-LOCK
       WHERE blandverzend.rbvnr EQ bxbfil.cbasi
         AND blandverzend.rland EQ bxrvorve.rland,
        EACH bxrvorre OF bxrvor NO-LOCK
       WHERE bxrvorre.cstatbe  EQ "J"
          OR bxrvorre.cstatte  EQ "J"
          OR bxrvorre.cstatko  EQ "J"
          OR bxrvorre.cstatem  EQ "J"
          OR (bxrvorre.cstatve EQ "J" AND bxrvorre.qfakt NE 0)
       BREAK BY bxrvor.radrebd
             BY bxrvor.radre
             BY bxrvor.rbeta    /* een betalingskonditie per faktuur */
             BY bxrvor.rlandr   /* een btw regime per faktuur */
             BY bxrvor.rvalu    /* een valuta per faktuur */
             BY bxrvor.rklas    /* een btwklasse per faktuur */
             BY bbetaaldebiteur.radre
             BY bxrvor.cverz    /* CA 23012 */
             BY bxrvor.rpref
             BY bxrvor.rordn
             BY bxrvorre.rrgln:

      FIND xbfil          WHERE ROWID(xbfil)          = ROWID(bxbfil)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbfil THEN DO:
         MESSAGE "xbfil niet gevonden." SKIP
                 "Sleutel:" bxbfil.rbvnr SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbkal          WHERE ROWID(xbkal)          = ROWID(bxbkal)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbkal THEN DO:
         MESSAGE "xbkal niet gevonden." SKIP
                 "Sleutel:" bxbkal.rbvnr bxbkal.ddatu SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbjnb          WHERE ROWID(xbjnb)          = ROWID(bxbjnb)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbjnb THEN DO:
         MESSAGE "xbjnb niet gevonden." SKIP
                 "Sleutel:" bxbjnb.rbvnr SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbpar          WHERE ROWID(xbpar)          = ROWID(bxbpar)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbpar THEN DO:
         MESSAGE "xbpar niet gevonden." SKIP
                 "Sleutel:" bxbpar.rpara SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbdag          WHERE ROWID(xbdag)          = ROWID(bxbdag)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbdag THEN DO:
         MESSAGE "xbdag niet gevonden." SKIP
                 "Sleutel:" bxbdag.rbvnr SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND mbdag          WHERE ROWID(mbdag)          = ROWID(bmbdag)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE mbdag THEN DO:
         MESSAGE "mbdag niet gevonden." SKIP
                 "Sleutel:" bmbdag.rc_filbas SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xrvor          WHERE ROWID(xrvor)          = ROWID(bxrvor)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xrvor THEN DO:
         MESSAGE "xrvor niet gevonden." SKIP
                 "Sleutel:" bxrvor.rbvnr bxrvor.rpref bxrvor.rordn SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbbek          WHERE ROWID(xbbek)          = ROWID(bxbbek)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbbek THEN DO:
         MESSAGE "xbbek niet gevonden." SKIP
                 "Sleutel:" bxbbek.rbvnr bxbbek.rbeta SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xrvorve        WHERE ROWID(xrvorve)        = ROWID(bxrvorve)        NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xrvorve THEN DO:
         MESSAGE "xrvorve niet gevonden." SKIP
                 "Sleutel:" bxrvorve.rbvnr bxrvorve.rpref bxrvorve.rordn SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbval          WHERE ROWID(xbval)          = ROWID(bxbval)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbval THEN DO:
         MESSAGE "xbval niet gevonden." SKIP
                 "Sleutel:" bxbval.rbvnr bxbval.rvalu SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND afnemer        WHERE ROWID(afnemer)        = ROWID(bafnemer)        NO-LOCK NO-ERROR.
      IF NOT AVAILABLE afnemer THEN DO:
         MESSAGE "afnemer (xbnaw) niet gevonden." SKIP
                 "Sleutel:" bafnemer.rbvnr bafnemer.radrg bafnemer.radre bafnemer.qadre SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND landafnemer    WHERE ROWID(landafnemer)    = ROWID(blandafnemer)    NO-LOCK NO-ERROR.
      IF NOT AVAILABLE landafnemer THEN DO:
         MESSAGE "landafnemer (xblnd) niet gevonden." SKIP
                 "Sleutel:" blandafnemer.rbvnr blandafnemer.rland SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND landverzend    WHERE ROWID(landverzend)    = ROWID(blandverzend)    NO-LOCK NO-ERROR.
      IF NOT AVAILABLE landverzend THEN DO:
         MESSAGE "landverzend (xblnd) niet gevonden." SKIP
                 "Sleutel:" blandverzend.rbvnr blandverzend.rland SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND betaaldebiteur WHERE ROWID(betaaldebiteur) = ROWID(bbetaaldebiteur) NO-LOCK NO-ERROR.
      IF NOT AVAILABLE betaaldebiteur THEN DO:
         MESSAGE "betaaldebiteur (xbnaw) niet gevonden." SKIP
                 "Sleutel:" bbetaaldebiteur.rbvnr bbetaaldebiteur.radrg bbetaaldebiteur.radre
                            bbetaaldebiteur.qadre SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xrvorre        WHERE ROWID(xrvorre)        = ROWID(bxrvorre)        NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xrvorre THEN DO:
         MESSAGE "xrvorre niet gevonden." SKIP
                 "Sleutel:" bxrvorre.rbvnr bxrvorre.rpref bxrvorre.rordn bxrvorre.rrgln SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.
      FIND xbafn          WHERE ROWID(xbafn)          = ROWID(bxbafn)          NO-LOCK NO-ERROR.
      IF NOT AVAILABLE xbafn THEN DO:
         MESSAGE "xbafn niet gevonden." SKIP
                 "Sleutel:" bxbafn.rbvnr bxbafn.radre SKIP(2)
                 "Waarschuw applicatiebeheer!"
         VIEW-AS ALERT-BOX ERROR BUTTONS OK.
         UNDO, LEAVE.
      END.

We write in a file some of the contents of the bxrvorre and after getting the (shared buffers) xrvorre we write that contents to file too.
It happens that the bxrvorre is correct, but the xrvorre is not. It is really weird.

@trx
I understand what you mean, but the last changes on the record we are discussing is in the afternoon, after that a few hours nothing. Late in the afternoon someone else starts invoicing and some of the records (1 or 2 per invoice run) are not correct.

Tom, my hunch are the shared buffers, but there is nothing to proof that. Also it is not clear why this is 'suddenly' happing. Therefore I was wondering if this could have anything to do with resources. But that would result in all kinds of errors in the .lg files.

@Tom
A rollback is not likely. What we see in the auditing files is this:
creation of the records.
Assigning the values
deleting of the records (with the correct contents).

That is all. My conclusion, based on auditing data, is that the correct record was deleted during invoicing. So why was it not processed with the correct contents?
 

Vaalen

Member
Yesterday we had another error situation. The bxvorre buffer in the FOR EACH loop was as (partly) empty as the shared buffer xrvorre after fetching it with ROWID.
It shouldn't be empty though.
The fact that it satifies the FOR EACH conditions suggests it is not, anyway.
 

TomBascom

Curmudgeon
1) Just for kicks, try adding -rereadnolock

2) Is there an actual problem??? You say that you are selecting the proper records and deleting the proper records. The only thing that you seem to be complaining about is: that under some circumstances that don't seem to actually matter to any business process, the values in certain fields of a certain shared buffer aren't what you expect them to be? (And the code that demonstrates this doesn't seem to be posted...)

3) Since the TRANSACTION seems to be pointless how about removing it? Also, why not just plain "LEAVE" instead of "UNDO, LEAVE" (there being nothing to UNDO...)?
 

Vaalen

Member
There is a problem, the orderlines involved do NOT appear on the invoice, but they should. So our invoices are not correct.

Do you really want a piece of out logging? Oké, here it comes.

This logging comes right after the FOR EACH with some content of bxrvor.
Code:
RUN mxv/logfakt.p("B", INPUT BUFFER bxrvor:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("B", INPUT BUFFER bxrvorre:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("AA", INPUT BUFFER bxrvor:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("AA", INPUT BUFFER bxrvorre:HANDLE) NO-ERROR.

After fetching all the records with ROWID's there comes more:
Code:
RUN mxv/logfakt.p("B", INPUT BUFFER xrvor:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("B", INPUT BUFFER xrvorre:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("AA", INPUT BUFFER xrvor:HANDLE) NO-ERROR.
RUN mxv/logfakt.p("AA", INPUT BUFFER xrvorre:HANDLE) NO-ERROR.

In yesterday's case (orderline 8 never showed on the invoice) the logging showed us this:


contents bxrvorre
Code:
POPP 21/12/11 17:31:19 34384562   mxv/pxft000.p   B     713673 713673          john      xrvor     0                             
                                                       713673                
POPP 21/12/11 17:31:19 34384563   mxv/pxft000.p   B     713673 713673          john      xrvorre   8                             
                                                       713673                
POPP 21/12/11 17:31:19 34384564   mxv/pxft000.p   AA    713673 713673          john      xrvor     0                             
xrvor: 713673  # 865700  # Nee     #         # Nieuw: no 
POPP 21/12/11 17:31:19 34384565   mxv/pxft000.p   AA    713673 713673          john      xrvorre   8                             
xrvorre: 8       #         #         #         #         #         # 0       #

contents xrvorre
Code:
POPP 21/12/11 17:31:19 34384566   mxv/pxft000.p   B     713673 713673          john      xrvor     0                             
                                                       713673                
POPP 21/12/11 17:31:19 34384568   mxv/pxft000.p   B     713673 713673          john      xrvorre   8                             
                                                       713673                
POPP 21/12/11 17:31:19 34384569   mxv/pxft000.p   AA    713673 713673          john      xrvor     0                             
xrvor: 713673  # 865700  # Nee     #         # Nieuw: no 
POPP 21/12/11 17:31:19 34384570   mxv/pxft000.p   AA    713673 713673          john      xrvorre   8                             
xrvorre: 8       #         #         #         #         #         # 0       #

Now, the last line shows the contents of the fields for the FOR EACH (bxrvorre.cstatbe, bxrvorre.cstatte, bxrvorre.cstatko, bxrvorre.cstatem, bxrvorre.cstatve and bxrvorre.qfakt). You can see, there is nothing there. The first field is line number of the order line. Lines 1-7 en 9-10 are oke, and actually on the invoice.


Auditing (just on field qfakt, the last field on the last line of the logging)


21/12/2011 13:44:14 john 5100 qfakt 0 │
│21/12/2011 17:01:02 Login 5101 qfakt 0 1 │
│21/12/2011 17:31:19 john 5102 qfakt 1 │

5100 is creation of the record, 5101 is reported ready for invoicing at 17.01. Last action is deletion from invoicing. With a correct qfakt of 1, which we do not see in our logging.
 

TomBascom

Curmudgeon
So you selected orderline 8, logged orderline 8 and deleted orderline 8 but it never showed up on the invoice? (Not even as a blank line?)

What happens if you modify your logging to re-read the record using a "local" buffer?
 

Vaalen

Member
It doesn't show up because at the very last moment when the amount is 0, the line will not be printed (even though it is selected). Amount is qfakt (amount to be invoiced).

Yes, that is the situation. Line 8 is selected but has a qfakt 0.

We are re-reading xrvorre in the program that logs:

ip_record is handle of record involved, input parameter.

Code:
    CREATE BUFFER h-buffer FOR TABLE ip_record:TABLE BUFFER-NAME 'bf-' + ip_record:TABLE.
    h-buffer:FIND-BY-ROWID(ip_Record:ROWID, NO-LOCK).
 
    ip_Record:BUFFER-COMPARE(h-buffer, 'binary', cDiff).
    IF cDiff NE "" THEN DO:
        REPEAT iTel = 1 to num-entries(cDiff):
            ASSIGN cField = ENTRY(iTel, cDiff).
            PUT STREAM st-out
                CAPS(filreg#)                                   AT  1
                TODAY  FORMAT "99/99/99"                        AT  6
                STRING(TIME, "HH:MM:SS")                        AT 15
                STRING(ETIME)                                   AT 24
                PROGRAM-NAME(2) FORMAT "x(14)"                  AT 35
                "Differences"                                   AT 55
                cField        FORMAT "x(11)"                    AT 67
                ip_Record:BUFFER-FIELD(cField):BUFFER-VALUE()   AT 80
                SKIP
                h-buffer:BUFFER-FIELD(cField):BUFFER-VALUE()    AT 80
                SKIP.
        END.
    END.

In this case we do not find any string "Differences" in the logging.
 

TomBascom

Curmudgeon
I know that I'm grasping at straws but what happens if you try that code above without the 'bf-' + part of things?
 

Vaalen

Member
Unfortunately, that is not possible. The include with the shared buffers in also included here. So shared buffer xrvorre is already known. We should write another program to do so.
 

Vaalen

Member
The -rereadnolock parameter seems to do the trick. We haven't had any problems so far. Our invoicing is still quite low, but nevertheless....

Remains the question: what happened, and why?
 
Top