COMMIT en SQLRPGLE

RPG (3 et 4, free), CL, SQL, etc...
Répondre
PBENECH
Messages : 1
Enregistré le : lun. 21 déc. 2015, 15:56:21

COMMIT en SQLRPGLE

Message par PBENECH »

Bonjour,

J'ai besoin de faire des mises à jour de fichier en ne rendant accessibles les données, qu'à la fin de mon programme.
Dans mon exemple, j'ai journalisé le fichier RAM_ECHAN2.
le début du pgm commence par:

/Free
exec sql set option
commit = *chg,
closqlcsr = *endmod;
/End-Free

Voici la requête SQL

C/Exec Sql
C+ UPDATE Ram_Echan2
C+ SET STATUT = :F3Statut
C+ WHERE Nature = :E1Nature and
C+ Statut = :C1Statut and
C+ Date(Date_Depot) = :E1Date_d
C/End-exec

C Eval B_Valide_F3 = *On

C/Exec Sql
+ Commit
C/End-exec


Je m'aperçois, en mettant un point d'arrêt en debug, sur la ligne b_Valide_F3 que les enregistrements modifiés sont déjà accessibles avant le COMMIT.

Le pgm est compilé avec l'option COMMIT(*CHG) et le cl appelant contient les lignes
STRCMTCTL LCKLVL(*CHG) CMTSCOPE(*JOB)
CALL PGM
ENDCMTCTL

Merci de m'aider à comprendre.

cmasse
Site Admin
Messages : 813
Enregistré le : mer. 14 févr. 2007, 18:00:03
Localisation : Nantes
Contact :

Niveau d'isolation

Message par cmasse »

Normal, le Commit (sur DB2 for i) a toujours fonctionné comme cela !

Code : Tout sélectionner

Can “updated” rows be read by other application processes that are running at the UR or NC isolation level? 	Yes

Examples of Phenomena:

P1
    Dirty Read. Unit of work UW1 modifies a row. Unit of work UW2 reads that row before UW1 performs a COMMIT. UW1 then performs a ROLLBACK. UW2 has read a nonexistent row.
P2
    Nonrepeatable Read. Unit of work UW1 reads a row. Unit of work UW2 modifies that row and performs a COMMIT. UW1 then re-reads the row and obtains the modified data value.
P3
    Phantom. Unit of work UW1 reads the set of n rows that satisfies some search condition. Unit of work UW2 then INSERTs one or more rows that satisfies the search condition. UW1 then repeats the initial read with the same search condition and obtains the original rows plus the inserted rows.


http://www-01.ibm.com/support/knowledge ... tm?lang=fr

Le seul moyen c'est que les autres JOB soient en isolation *CS et avec l'option Use currently committed

http://www-01.ibm.com/support/knowledge ... tm?lang=fr
Christian Massé (Volubis.fr)

Répondre