Avoid reading uncommitted records in AS400…
25 pts.
0
Q:
Avoid reading uncommitted records in AS400...
is it possible to avoid reading uncommited records in AS400?
ASKED: Sep 5 2009  5:22 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
24600 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
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 Answered: Sep 9 2009  1:05 PM GMT by Philpl1jb   24600 pts.
Latest Contributors: CharlieBrowne   6540 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Philpl1jb   24600 pts.  |   Sep 7 2009  1:36PM GMT

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

 

As400xyz   25 pts.  |   Sep 8 2009  11:38AM GMT

yes…records are accessed through RPG program in INPUT mode

i.e: Using opcode READ(N)

and same access path.

 

As400xyz   25 pts.  |   Sep 9 2009  6:46AM GMT

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.

 

Splat   1070 pts.  |   Sep 9 2009  3:51PM GMT

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.

 
0