Adabas Field Index PE and MU

Good day

I need some guidence
I have fields that is in a group and one mu

As i understood is that a group act in the same maner as a PE (retaining position)
If i empty index 1 the index 2, 3 must move up so index2 become index1 and so on
What will be the best way to do this
Current setup
Ex: GR 01 Details
02 Name A 30
02 Surname A 30
MU 02 Notes A 253 6

Posible option
MU 1 Details A 253 6 AA
RE 1 Details
2 Name A 30
2 Surname A 30
MU 2 Notes A 253 3

Please Advice

I am having difficulty understanding what your belief is and what you are wishing to do, so my response will be more general.

Fields grouped together as a GR do not imply anything with regards to MU positionality. PE group columns do maintain positionality across all fields in a PE group as they function like a child table within a table, and you would not want the elements collapsing if one or more fields in a PE group are null/empty. An MU field does not inherit this property on the MU index regardless of whether it is standalone, contained within a PE group (though the PE index does have that property) or contained within a GR group.

If you are asking how can you make it appear to not collapse occurrences, one trick I learned early in my career is to move a x’FF’ value to any occurrence you wish to appear blank. ADABAS will not collapse this occurrence when committed to the database as it is not truly empty/null, but it is generally non-printable so it appears to be blank to the user. Of course, your programming logic will need to handle such values to ensure blank lines you wish to preserve contain this high-value constant. You will need to do something like this if you wish to end up with this being preserved:

Notes(1) := ‘This is my first line in notes.’
Notes(2) := ‘This is my second line in notes.’
Notes(3) := H’FF’
Notes(4) := ‘I just made a blank line before this and it is preserved.’

I hope I am addressing your question properly.

Just to add on to Brian’s reply:

The positionality of MU occurrences is affected by its compression options, not whether it is in a group or periodic group. If the multi-valued field is using ordinary compression, the MU occurrences will maintain positionality, regardless of whether they contain null values or not. If the MU is null suppressed, then null-valued occurrences will be dropped out of the array and the remaining not-null occurrences will be moved up in the MU. If the MU is not null suppressed (ordinary compression), then the MU count will always reflect the highest index used on an add/update, even if those occurrences contain null values.

Periodic groups have no option for suppressing/dropping occurrences (except for trailing null-suppressed occurrences). If you need to remove occurrence 1, you will need to programmatically move the other occurrences down one occurrence and null out the highest occurrence.

Also note that if using a “Details A(253)” field, the redefinition cannot be larger than the base field. In addition, any current version of Adabas and Natural support alpha fields longer than 253 bytes, so you may not need to use a MU field, just a longer alpha field (up to 16381 bytes) or a dynamic alpha field (which can be variable length up to almost 2gb).

Good day

Thank you for the detail it does make sense.

What I try to do is like in Natural I create an array as follow

01 Details (6)

02 Name (A10)

02 Adress1 (A10)

02 Adress2 (A10)

02 Comment (A253:6)

How can I accomplish this in Adabas

Regards Derick

1.jpg

The program’s view would look like

1 file   VIEW file-name
  2 DETAILS (6)
    3 NAME (A10)
    3 ADRESS1 (A10)
    3 ADRESS2 (A10)
    3 COMMENT (A253/6)

You would need a DDM for Natural and an FDT for Adabas. Both would define DETAILS as a PE and COMMENT as an MU.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.