× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Joe,

Although it is my strong believe that the simpliest answer is ussually the
correct one, in this case I tend to believe the no 4!!! lol...

1 and 2: In those cases, ALL order lines of a single order would get
duplicate, but in my case only a few of the lines do...
3: There is only one write statement in the B program...
4........
5. No other program is writing to the file.... It's a small independent
module (Track and Trace).

Here is the snippets of the 2 programs:

*PGM A*



D UpdTatDtlRec pr extpgm('UPDTATDTL')

D outParm likeds(TatDtl_Rec)

……

TdIOReq = '*WRITE';

UpdTatDtlRec(TatDtl_Rec:TdErrChk); ---- PGM B



*PGM B*



ErrorCode = *Blanks;

TatDtl_Rec = inParm;



Select;

When TDIOReq = '*WRITE';

* WriteRecord(); *

When TDIOReq = '*UPDATE';

UpdateRecord();

When TDIOReq = '*DELETE';

DeleteRecord();

When TDIOReq = '*REMOVE';

EndSL;

….

P WriteRecord b

d WriteRecord pi



// Validate Input



If ValidateData(ErrChk) = 'Y';



// Write Record



// TdPrSt = *Blanks;

Write TatDtlR;



EndIf;

P WriteRecord e



message: 3
date: Tue, 15 May 2018 08:05:43 -0500
from: Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx>
subject: Re: One Write, two records....

Hi Costa!? Welcome to the world of intermittent errors.? :)

On these, the first thing to do is to identify the possible causes and
eliminate some of them.

In my mind, here are the possibilities:

1. Program A is getting called twice for the same order
2. Program A is calling program B twice for the same line
3. Program B is being called once but executing WRITE twice
4. Program B is executing WRITE once but the IBM i database is writing
two records
5. Some unknown program C is doing the same WRITE as program B

Someone might come up with more, but those are my choices.? Option 4 is
awfully far-fetched, but I include it for completeness.? Use a journal
if you suspect option 5; it will tell you if some other program or job
is writing to the same file.

Other than that, then, you have options 1, 2 and 3.? Option 1 seems
unlikely since the duplicate is for only certain lines.? So let's check
2 and 3.? The brute force method is pretty simple. Create a file with
program name, order and line number.? Every time program A calls program
B, it writes a record to that file. Every time program B writes a record
to the order file it also writes a record to the work file.

The next time the duplicate occurs, interrogate the file.? Either you'll
see program A calling program B twice with the same order and line, or
you'll see program A calling program B once and program B writing the
record twice.? That will identify which part of the business logic needs
to be debugged more thoroughly.

I know it's pretty basic stuff, but that's what I do.? A lot.? So I've
gotten pretty good at it.? :)



Hello,

The whole team I work with is facing a weird issue.

Program A loops per order and calls program B, program B is doing just a
write to a file (order lines) using the input parms from A.

Occasionally though, program B is writing 2 lines (duplicate) for some of
the order lines, not all. By deleting the records and rerunning the
process, no duplicates are written.... So we can not reproduce the fault.

I added a FEOD in pgm B, but we still get the duplicates once in a while.

The release is V7R1M0.

Both programs are RPGLE, in DFTACTGRP.

Any hints?

Thank you in advance,
Costa




As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.