25 pts.
 Avoid reading uncommitted records in AS400…
is it possible to avoid reading uncommited records in AS400?

Software/Hardware used:
ASKED: September 5, 2009  5:22 AM
UPDATED: September 9, 2009  3:51 PM

Answer Wiki:
I do not believe your processing program can determine if a record is committed. This is a system function. The records will not commit until you issue the commit command, so you would need to keep track of the records in your code. ------------------------- SO this program locked the records .. perhaps changing the records and you want a way to know if they are not yet committed. I think you will have to keep an array of Uncommitted keys and check the records you are reading against the array. Phil --------------- How about changing PGMA WRITE FILE-B WRITE FILE-A COMMIT seems way to simple. Phil
Last Wiki Answer Submitted:  September 9, 2009  1:05 pm  by  philpl1jb   44,180 pts.
All Answer Wiki Contributors:  philpl1jb   44,180 pts. , CharlieBrowne   32,855 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Not enough info
Uncommitted records are locked and a native I/O read or chain for update would encunter an error — unless they were locked by this program in this access path.

I don’t know how a Select for update would act on locked records.

So here are some questions – are you attempting to access these records in native I/O?
If by native I/O – the same program and the same access path.

Phil

 44,180 pts.

 

yes…records are accessed through RPG program in INPUT mode

i.e: Using opcode READ(N)

and same access path.

 25 pts.

 

Example:

    PGM-A

WRITE FILE-A
WRITE FILE-B
COMMIT

    PGM-B-

READ FILE-A
WRITE FILE-C (FROM FILE-A)

There is an error occured while writing in FILE-B. Due to this error PGM-A in message wait(MSGW) after writing a record (Ex: RCD-A) in FILE-A.

PGM-B is reading the uncommitted record (RCD-A) from FILE-A and writing into FILE-C.

In above scenario, Is there any solution to prevent reading uncommited record (RCD-A) by PGM-B? Note: PGM-A is only maintained by us.

 25 pts.

 

I’m not familiar with the particular problem, but I’d recommend putting the (E) extender on the WRITE operation (e.g.: WRITE(E)), and wrap the whole thing in a MONITOR group.

 5,670 pts.