tpayne
Reputable Poster
I started a new contract and the company is having problems with some of it's recursive versions, where the main version ends up getting deleted and/or the contents changed.
Ironically most fo the historical postings on DW recursion on JDEList are several threads of mine from 4+ years ago, long enough for me to forget what caused the problem and what I did to fix it.
The recursion process works by copying the Form/Version being executed to +Form/NewVersion, where the last 4 digits of the version are replaced by a sequence that begins at '0001', or if the original version had 4 digits as the last 4 characters, starting with the next in sequence from that.
This is done in program P98310, when either a menu option is called, or from the DW Version List (P98302) when option '1' is taken to Run a version. It runs interactively.
The program checks that no records exist for +Form/NewVersion on F98301 (DW Header File), looping and adding 0001 to the version number if they do.
If all is ok, it proceeds to copy the old version to the new in F98301, then F9831, F98311, F98312 and F98303.
The problem we are getting is...
P98310 31500 F98311 attempts to write duplicate record (C G S D F)
where for some reason records exist on F98311.
The program does not check for records already existing in the other files before copying, only in F98301.
Problem is, I can't figure out how records are getting left behind in F98311, and what will happen if 2 users try to create the same version at the same time.
In theory, one session should write to F98301, and the second should find that data exists, therefore incrementing the version number.
The Global Recursive cleanup (J/P98305G) is run weekly, and this deletes all recursive records from F98301/303/311/312 using SQL, so it can't be really old data being left behind.
The user is getting an error when this happens, and they have been ignoring it, resulting in the copy of the version failing, and the version being executed being the main one. I was able to prove this using Debug on P98310 and forcing this error to be generated.
If the user presses Enter after receiving the error, the version list then displays the original Form/Version, and the data gets updated in that, which is not desirable.
I also do not understand how the original version is sometimes disappearing, since the CL programs only delete this if the Form begins with "+".
My plan is to check for the existance of the new version on all 5 files before performing the copy, which ought to stop this from happening. It's a fairly simple modification to P98310.
Any thoughts on this from the other DW experts out there?
Ironically most fo the historical postings on DW recursion on JDEList are several threads of mine from 4+ years ago, long enough for me to forget what caused the problem and what I did to fix it.
The recursion process works by copying the Form/Version being executed to +Form/NewVersion, where the last 4 digits of the version are replaced by a sequence that begins at '0001', or if the original version had 4 digits as the last 4 characters, starting with the next in sequence from that.
This is done in program P98310, when either a menu option is called, or from the DW Version List (P98302) when option '1' is taken to Run a version. It runs interactively.
The program checks that no records exist for +Form/NewVersion on F98301 (DW Header File), looping and adding 0001 to the version number if they do.
If all is ok, it proceeds to copy the old version to the new in F98301, then F9831, F98311, F98312 and F98303.
The problem we are getting is...
P98310 31500 F98311 attempts to write duplicate record (C G S D F)
where for some reason records exist on F98311.
The program does not check for records already existing in the other files before copying, only in F98301.
Problem is, I can't figure out how records are getting left behind in F98311, and what will happen if 2 users try to create the same version at the same time.
In theory, one session should write to F98301, and the second should find that data exists, therefore incrementing the version number.
The Global Recursive cleanup (J/P98305G) is run weekly, and this deletes all recursive records from F98301/303/311/312 using SQL, so it can't be really old data being left behind.
The user is getting an error when this happens, and they have been ignoring it, resulting in the copy of the version failing, and the version being executed being the main one. I was able to prove this using Debug on P98310 and forcing this error to be generated.
If the user presses Enter after receiving the error, the version list then displays the original Form/Version, and the data gets updated in that, which is not desirable.
I also do not understand how the original version is sometimes disappearing, since the CL programs only delete this if the Form begins with "+".
My plan is to check for the existance of the new version on all 5 files before performing the copy, which ought to stop this from happening. It's a fairly simple modification to P98310.
Any thoughts on this from the other DW experts out there?