how to judge one journal record is insert/update/delete operation for one table?

hi

   I want to find the journal records  that indicate the insert/update/delete operation for my table.  I can read the journal file but there is so many records and I want to know  is there some method or property which can judge one journal record  for insert/update/delete operation for my table?

 

 

thanks

Vote up!
Vote down!

Rating: 0

1 answer

Answer

You can run the List query in the %SYS.Journal.Record class, using the 'Match' parameter to match for specific global names (based on your table). It is documented (with some examples) here

 

 

Vote up!
Vote down!

Rating: 0

thanks very much!   

Now I can get the records by your answer, and I  can get the old/new value for each record  like this 

  w rs.Get("NewValue")

 

the output likes this,   aa  jj is the value of 2 columns in my table

 

my question is: How to split these old/new value  to each column?

Vote up!
Vote down!

Rating: 0

Caché stores data from tables in globals in $listbuild format. So you can use $listget, to get value from the particluar column, but you should know number for your column.

Vote up!
Vote down!

Rating: 1

thanks! But rs.Get("NewValue") returns   string not list

I convert it to list like this:

 set columnValues= $EXTRACT(s,5,*) //remove the header
  set delimiter=$CHAR(4)_$CHAR(1)
  set columnCount= $LENGTH(columnValues, delimiter)
  SET list=$LISTFROMSTRING(columnValues,delimiter)

Is there other better method for convert to list?

Vote up!
Vote down!

Rating: 0

command WRITE, outputs $listbuild in binary format, if you would use ZWRITE, it would show you $lb

I've just made variable from your output

USER>zzdump val

0000: 02 01 04 01 61 61 04 01 4A 4A                           ....aa..JJ
USER>zwrite val
val=$lb("","aa","JJ")

Just read the documentation and you will get everything needed to work with $listbuild

Vote up!
Vote down!

Rating: 0

Log in to answer