Find the fieldname that is written to

oldemanw

Member
I would like to find the table(s) and fieldname(s) that are being written to by a program.
In this case, I only have the compiled .r code.
Is it possible to run this program from within a wrapper, where there is something like:

{pseudocode}
ON WRITE OF ANY TABLE DO:
MESSAGE TABLENAME FIELDNAME.
END.

Any hint is welcome, thanks up front :)
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
You can use the _TableStat or _UserTableStat VSTs as a partial solution. They can contain statistics on creates, reads, updates, and deletes for each table. I say "can contain" because by default the database only keeps stats on the first 50 tables in the schema. You can adjust this by specifying the -tablerangesize database startup parameter. So if you have 200 application tables, you can specify -tablerangesize 200 as a parameter in your DB startup, and after your next DB restart you will have those stats available.

The _UserTableStat table, as the name suggests, breaks down the _TableStat data by user. So this would be a better table to look at for you than _TableStat, as the latter could cloud the picture by including other users' CRUD stats.

Note this will only give you stats at the table level, it won't tell you about field changes. Also, stats continue to accumulate for as long as the DB is running, or until you issue a command to wipe them out: proutil <dbname> -C zerostats.

I suppose you could do something with database triggers or with OpenEdge auditing if you really need info on field changes, but either approach involves database changes and coding and is a non-trivial amount of work. Is it worth the payoff? That's your call. I hope this helps.
 

oldemanw

Member
Thank you both.

I'll try to explain why, it is about MFG/PRO.
A user created a memo invoice and aborted/crashed halfway through the memo program. The memo is now "partially" created. It is shown in some reports, but is missing from other reports where I would expect to see it. In reports where it is missing, the value of the memo shows, but the referencenumber is blank.
This makes me believe that some table(s) were not updated when the memo was created.

I'm trying to find the tables that are touched by the memo creation program, so that I can hunt down the record in error / missing record.
So, my idea was to run the memo creation program (on a test system) within a wrapper and then replay the creation of a memo invoice. Then, if the program would write to a table, I would like to see in which table a record is created.

I already looked at the most obvious tables, ar_mstr, ard_det, glt_det, gltr_hist, tx2d_det. The data there seems fine.


Meanwhile I think I got closer to find a solution.
The .r code contains tablenames, which narrows down my search to about 15 tables, which should be do-able. But if there are better ideas then this, I'd love to hear your suggestion.
 

TomBascom

Curmudgeon
I would think your best bet would be to call QAD support...

Failing that, and lacking source, the r-code is probably your best bet.
 

oldemanw

Member
I found the cause. The problem was in ard_det after all, I should have looked closer.
Anyway, from the expert responses, I understand that there is no "ON WRITE OF ANYTABLE" trigger, which is another bit of knowlegde :)

Thank you all.
 

TomBascom

Curmudgeon
That's true.

But you could fake it ;)

It would be ugly but you could generate a program by reading _file. That program /could/ create session triggers for every table in the schema...
 

oldemanw

Member
That is a good hint indeed, create "on write" triggers for all tables in _file during the session.
I'll give it a try. If I can get it to work, I'll let you guys know.
 
Top