Background:
We plan to upgrade to Adabas v8.2.x sometime this year.
.
Business Scenario:
We would like to add “System Fields” with SY=TIME to all of our existing files. Then later we can use these System Fields to extract changed records and replicate them to a data warehouse.
.
Example:
ADACMP COMPRESS FNDEF (or ADADBS CHANGE)
01,TI,14,U,MU,NU,DT=E(DATETIME),SY=TIME
.
Q1) Is this a reasonable use for System Fields ?
.
Q2) How can “System Fields” be “initialised” (eg. to a default datetime, like “today”), if they are added to existing files ?
.
Q3) Will the unloading & reloading of an Adabas file affect the contents of any “System Fields” defined with SY=TIME ?
.
Q4) Are there any potential pitfalls with this approach ?
.
Sorry, I meant to define an elementary field (not an MU).
So the ADACMP FNDEF should have been:
01,TI,14,U,NU,DT=E(DATETIME),SY=TIME
ad Q4) Are you aware that you cannot “replicate” deleted records by this method ?
Aldo
@ Peter Holmick
please note that system fields either require CR option or MU option.
The reason behind this is that with the CR option the system field is set when the record is inserted and there is only one value possible.
Without the CR option the field is set with each update and for keeping an update history of up to SYFMAXUV values it requires MU.
@ Q1: yes, in my opinion: simplifies applications, can enforce standards for documenting update events.
@ Q2: system fields added after the file was loaded will be empty (both CR or non CR) and non CR fields will be filled when the record is updated.
@ Q3: ADAULD/ADALOD will not modify system fields. The same applies to ADACMP. When you compress input data system fields must be present as defined but may be empty. Alternatively, you could use a format definition omitting system fields, but ADACMP will leave system field values empty.
Thank you for the replies.
.
Here is the SYFMAXUV docu:
http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada823mfr/adamf/util/adalod-load.htm#adalod-load
http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada823mfr/adamf/util/adadbs-MODFCB.htm
.
SYFMAXUV: Maximum MU System Field Values
The SYFMAXUV parameter can be used to specify the maximum number of values kept for a system field with the MU option during the execution of an update (A1) command (in other words, the maximum number of occurrences allowed for MU system fields during the execution of an update command). The value set for SYFMAXUV applies to all system fields in the file with the MU option. Valid values are integers from 1 through 20. The maximum value for SYFMAXUV is 20.
The internal default, if SYFMAXUV is not specified, is zero (0), which Adabas interprets to mean that there is no setting for this parameter at the file level. In this case, Adabas will assume a default of 1.
.
My conclusions:
- Separate system fields are required for the Create value and the Update value(s) (eg. timestamps).
- A maximum of SYFMAXUV Update values are kept in the MU system field.
- Only the most recent SYFMAXUV values are kept in an MU system field. The oldest values are lost.
- mu-system-field(1) = newest value.
- mu-system-field(SYFMAXUV) = oldest value.
Q5) Are these conclusions corect?
@Marbod Mueller
No, an Adabas SY field can be defined without CR and without MU.
If Adabas lets you do this this is probably an error. How did you do this?
With ADACMP I get the following:
@Marbod Mueller:
Apologies for my delayed reply.
Mea culpa, I misinterpreted the docu.
Yes, you are correct.
Thank you.
.
NB. I have created Brainstorm Request #04969 asking for the ability to define an Adabas SY (NATTIME) field without the MU option.