C* Notation (Counters) in Data Areas

Hi all,

When using MU / PE fields in Adabas, the option exists to set-up C* notation fields (counters) which are automatically populated by Adabas to tell me the number of records which are populated - very useful.

To add such a field I can go to any LDA which contains a view of the DDM, left-click on the ‘P’ or ‘M’ type field and add the ‘Counter’ option. A new field with type ‘C’ appears directly above the ‘P’ or ‘M’ field that has the same field name. I can refer to the value of that field in a program by returning the value of .C*. Great!

However, I also would like this view of the DDM to be transferred into an object (another LDA but not a view) to be passed back up from the DB call. If I attempt to do an import of this LDA into an Object Data Area, the ‘C’ field is ignored. If I copy and paste the field’s line in, it comes up as an error:

NAT0428 Invalid variable name definition in a data structure

If I create a field using the C* notation, I get an error as the character * is not permitted in field names.

I typically transfer data between the database and the incoming structure through using ‘move by name’, for example:

move by name xmlview to xmlobj /* moves the view LDA to the Object LDA structure
/* OR
move by name xmlview to xmlpda /* moves the view LDA to a PDA structure

which will ignore the C* fields as they can’t exist in either ‘Object Data Area’ or ‘Parameter Data Area’ structures

Short of having to define a new field such as -counter in any LDA or PDA and then perform

Move view.c*xml-string to xmlobj.xml-string-counter

in every program which transfers a view to an object; does Software AG provide any other way of utilizing the ‘C’ type counter fields for PE/MU fields in other than specifically the ‘V’ view of the DDM?


After the MOVE BY NAME, add another MOVE for each C* field, but make the association easier with


Same field name, replacing * with #.

You should be aware of the fact that MOVE BY NAME can be quite expensive. You are doing separate MOVE’s for each field. With only a few fields in the view, who cares? BUT, if you have 100 fields, this can get quite expensive.

Another approach is to define a “mega field” which spans the entire view. For example, suppose you have thirty fields in the view (including a c* field), which in total comprise 320 bytes. Do a REDEFINE of the view to create xmlview-all which is A320.

Then have a MOVE xmlview-all to xmlobj-all /* where xmlobj-all is also a320

This does NOT solve your naming problem. Ralph’s suggestion is about the closest you will come to a reasonable facsimile for c*, so go with that. If you have many fields in the view, consider the mega field.

Thanks Ralph and Steve.

I’ve noticed that in Software AG’s XML compiler/reader generation program, they build a field called ‘C@xml-name’ to capture the counter. I’ll probably just use this, as I already differentiate local and db fields through pre-pending a ‘#’.

Steve, I realize that move by name is expensive since it will capture every field. However, as I’m populating a GUI interface and performing other actions, I need almost every field that is in my file (less than 100 fields, but roughly 50-80). In all honestly, I prefer it due to its simplicity (move by name) versus hard-coding 50 field names into the program. It gives me flexibility to change or add a field in both the calling object and in the DB without having to do anything to the intervening programs.

I will probably look into other options if a performance bottleneck is identified.