cQJRNLT ;Show data from journalspace ;cQJRNLT; ; Compiled March 5, 2009 12:13:23 Q ; ;Switch to a different journal file $$JRNSWCH^JRNUTIL(jrnfile,mode) ;Open a journal file $$OPENJRN^JRNUTIL(jrnfile) ;Close a journal file $$CLOSEJRN^JRNUTIL(jrnfile) ;Use a journal file $$USEJRN^JRNUTIL(jrnfile) ;Read a record from a journal file into a local array $$GETREC^JRNUTIL(rec addr,JRNODE) ;Delete a record from a journal file $$DELREC^JRNUTIL(addr) ;Delete a journal file $$DELFILE^JRNUTIL(jrnfile) ; ;You can find them in the documentation, in the "Caché Advanced System Management Guide" ; "Chapter 9 Journaling". ; ; The steps required would be as follow: ;- open a journal file with $$OPENJRN^JRNUTIL(jrnfile); ;- use the journal with $$USEJRN^JRNUTIL(jrnfile) ;- start to parse all its records using the function $$GETREC^JRNUTIL(rec addr,JRNODE) in a loop ; (for the first address you can use 0) ;- close the journal file once you have finished. ; START ; select journalspace - copied from JRNDUMP W !!,"Show data from journalspace",!! D QQM^cQ6,BLD(.A) DISP F I=1:1:A W !,$J(I,3),". ",A(I) W !!,"Enter sequence number of desired journalspace: " R K G YZ:K="^",START:K="-" S K=+K I '$D(A(K)) W !!,"Invalid input",!! G DISP ; U 0 W !!,"Reading journalspace ",A(K),!!! D READ(A(K)) Q ; READ(J) ; read journalfile S (%JFILE,JFILE)=J S ns=$ZU(5) ZN "%SYS" S X=$$OPENJRN^JRNUTIL(%JFILE) I X'=1 G ERR S X=$$USEJRN^JRNUTIL(%JFILE) I X'=1 G ERR S ADDR=47382724 K GREFB,GREFC,SIZEC,SIZED,TGLOC,TGLOD,VALN,VALO,JRNODE F S X=$$GETREC^JRNUTIL(ADDR,.JRNODE) Q:X'=1 D Q:ADDR=0 . K ACT,GLO,GLON,GLOS,V,VO . U 0 W !,ADDR . S ADDR=$P($P(JRNODE(1,1),":"),"/",3) ; Get next address . S ACT=$P(JRNODE(1,1),":",2) ; Action . S GLO=$P(JRNODE(1,1),":",4,$L(JRNODE(1,1),":")) ; full global reference . S GLOS=$P($P(GLO,"^^",2),"""") S:'$L(GLOS) GLOS=0 ; database . S GLON="^"_$P($P(GLO,"("),"]",2) ; global . I $D(JRNODE(1,1,1)) S VO=JRNODE(1,1,1) . I $D(JRNODE(1,1,2)) S V=JRNODE(1,1,2) . S DATE=JRNODE(1,1,3),DAY=$ZD(+DATE,3,,4),TIME=+$P(DATE,",",2)\3600 . U 0 W !,ADDR,?10,ACT,!,GLO,!,GLON,! . U 0 I $D(VO) W !,"Old Value: ",VO . U 0 I $D(V) W !,"New Value: ",V . U 0 r k S X=$$CLOSEJRN^JRNUTIL(%JFILE) ZN ns ; ; YZ Q ; BLD(A) N K,JF,ns S ns=$ZU(5) zn "%SYS" K A S A=0,JF=$ZU(78,3) S:JF="" JF=$P($G(^%SYS("JOURNAL","LAST")),"^",2) I JF="" Q S A=A+1,A(A)=JF F S K=$$PREVJRN^JRNUTIL2(JF,.JF) Q:K'>0 I $ZU(140,4,JF)'<0 S A=A+1,A(A)=JF ZN ns Q ; ERR U 0 W !,$G(X),! G YZ ; ZZ ; 05.03.2009 - 12:13 * Cache-r6.1.0