MU and PE

Can anybody kindly explain what is the difference between a MU field and PE group with examples?

In Adabas an elementary field represents a single value per record, as you would expect. But Adabas also allows multi-valued fields (MU) which can represent 0 to 191 values per record (more, if the DBA allows it). Think of your salary as an example. You may be most concerned about your current salary value, but your management maintains a history of 0-n values.

EMP-ID   Surname Salary
10000010 Smith   100000
10001200 Jones    80000 
10032101 Zamboni 100000

In my example Smith’s salary history doesn’t make much sense. What we need is a set of additional fields for each salary. This multiple-value set is called a Perdiodic Group (PE). Our PE contains SALARY, CURRENCY, and START-DATE.

EMP-ID   Surname Salary Cur Start
10000010 Smith   100000 USD 2018.01.01
                  75000 EUR 2015.06.15
                 600000 HKD 2012.02.17
10001200 Jones    80000 EUR 2017.01.01
10032101 Zamboni 100000 USD 2018.07.15
                  90000 USD 2016.01.01
                  85000 USD 2015.12.01

An MU is identical to a vector in Working storage. A PE is identical to an array.

    3 SALARY (50)
    3 CURRENCY (50)
    3 START-DATE (50)
1 #HISTORY (50)
  2 #SALARY (P9.2)
  2 #CURRENCY (A3)
  2 #START (D)

A PE may contain one or more MUs.

1 Like

Thank you…the information was very much clear :slight_smile: