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 philpl1jb44,180 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
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.
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.
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
yes…records are accessed through RPG program in INPUT mode
i.e: Using opcode READ(N)
and same access path.
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.
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.