remove duplicates from a PE field in adabas without compression

i have a periodic field with duplicate occurences .I need to remove the duplicates and also move the non duplicate values up the occerence such that the c* field is updated with only single occurence of the field. Is there any way of selecting a range of array index like 3-7 indexes all together and move one place up in index when the duplicate is removed from the them.

Are you really talking about a PE(riodic GROUP) or a MU(ltiple value FIELD)

hi,
Periodic group with multivales… did find for the record…and it has dulicate vlaues in the indexes…have to remove them…since their is no compression that index remains balnk and the count (C*) doesnt change…so have to move the other index values up…and reset the sapces so that the occurences (C*) get rectified correctly…thanks for your help

To answer your original question, yes, you can do:

MOVE #VAR (3:7) TO #VAR (2:6)
RESET #VAR(7)

… and it behaves as you would expect it to. But, you can’t do the opposite (not that you want to in this case, just pointing it out):

MOVE #VAR (2:6) TO #VAR (3:7)
RESET #VAR(2)

If you try that you will end up with the value of #VAR(2) in occurrences 3 through 7.

What is not clear is whether you mean a PE that has MU fields in it? Or , as Wolfgang asked, do you have an MU? Or, a PE with just one field in it?

What do you mean by “duplicate values in the indexes”?

Can we see an example of the structure you are talking about?

Are you aware of the “old” way to update an MU, which does change the count?

Compressing an array in-place requires complicated or obscure logic. I’ll use a temporary array to simplify things.

First, here are the “before” and “after” images of the PE (although they don’t display well in a proportional font). The first column contains the count.

C* PRIVATE-ADDRESS      PRIVATE-ADDRESS          PRIVATE-CITY        Zip
-- --------------- ------------------------- -------------------- ----------
 
 9 PO Box 7        77 Sunset Strip           Los Angeles          90001
 
   Apt 9           45 Indiana Pl             Burbank              91501
   20th Floor      100 Universal City Plaza  Los Angeles          91608
 
 
 
 
   Suite 16        1313 Disneyland Dr        Anaheim              92802
C* PRIVATE-ADDRESS      PRIVATE-ADDRESS          PRIVATE-CITY        Zip
-- --------------- ------------------------- -------------------- ----------
 
 4 PO Box 7        77 Sunset Strip           Los Angeles          90001
   Apt 9           45 Indiana Pl             Burbank              91501
   20th Floor      100 Universal City Plaza  Los Angeles          91608
   Suite 16        1313 Disneyland Dr        Anaheim              92802

And here is the program, manipulating the demo Employees file. It includes an MU within the PE. Significant entries are copied to a temporary table. Then the temporary table is copied over top of the original.

DEFINE DATA LOCAL
1 #M (I4)          CONST <10>
1 EMP VIEW OF EMPLOYEES-V2009
  2 C*PRIVATE-ADDRESS (HD='C*')
  2 PRIVATE-ADDRESS
    3 PRIVATE-ADDRESS-LINE (#M, 1:2)
    3 PRIVATE-CITY         (#M)
    3 PRIVATE-POST-CODE    (#M) (HD='Zip')
    3 PRIVATE-COUNTRY      (#M)
    3 PRIVATE-AREA-CODE    (#M)
    3 PRIVATE-PHONE        (#M)
    3 PRIVATE-FAX          (#M)
    3 PRIVATE-MOBILE       (#M)
    3 PRIVATE-EMAIL        (#M, 1:2)

1 #PA (#M)
  2 PRIVATE-ADDRESS-LINE (U30/1:2)
  2 PRIVATE-CITY (U20)
  2 PRIVATE-POST-CODE (A10)
  2 PRIVATE-COUNTRY (A3)
  2 PRIVATE-AREA-CODE (A6)
  2 PRIVATE-PHONE (A15)
  2 PRIVATE-FAX (A15)
  2 PRIVATE-MOBILE (A15)
  2 PRIVATE-EMAIL (A80/1:2)
1 #OLD (I4)
1 #NEW (I4)
END-DEFINE
G. GET EMP 1
DISPLAY EMP.C*PRIVATE-ADDRESS (EM=Z9)  /* before
        EMP.PRIVATE-ADDRESS-LINE (*, 1) (AL=10)
        EMP.PRIVATE-ADDRESS-LINE (*, 2) (AL=25)
        EMP.PRIVATE-CITY (*)
        EMP.PRIVATE-POST-CODE (*)
*
FOR #OLD = 1 #M
  IF   NOT EMP.PRIVATE-ADDRESS-LINE (#OLD, *) <> U' '
   AND EMP.PRIVATE-CITY             (#OLD)     = U' '
   AND EMP.PRIVATE-POST-CODE        (#OLD)     =  ' '
   AND EMP.PRIVATE-COUNTRY          (#OLD)     =  ' '
   AND EMP.PRIVATE-AREA-CODE        (#OLD)     =  ' '
   AND EMP.PRIVATE-PHONE            (#OLD)     =  ' '
   AND EMP.PRIVATE-FAX              (#OLD)     =  ' '
   AND EMP.PRIVATE-MOBILE           (#OLD)     =  ' '
   AND NOT EMP.PRIVATE-EMAIL        (#OLD, *) <>  ' '
    THEN
      ESCAPE TOP                       /* Ignore empty entries
  END-IF
  ADD 1 TO #NEW
  MOVE BY NAME EMP.PRIVATE-ADDRESS (#OLD) TO #PA (#NEW)
END-FOR
MOVE BY NAME #PA (*) TO EMP.PRIVATE-ADDRESS (*)
UPDATE (G.)
GET EMP 1
NEWPAGE
DISPLAY EMP.C*PRIVATE-ADDRESS (EM=Z9)  /* after
        EMP.PRIVATE-ADDRESS-LINE (*, 1) (AL=10)
        EMP.PRIVATE-ADDRESS-LINE (*, 2) (AL=25)
        EMP.PRIVATE-CITY (*)
        EMP.PRIVATE-POST-CODE (*)
*
BACKOUT TRANSACTION
END