# Is it possible to move alphanumeric field to an array?

**URL:** <https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [May 27, 2017, 9:05am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794 "2017-05-27T09:05:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prithvi\_Vadaviya](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@Prithvi\_Vadaviya](https://techcommunity.softwareag.com/u/Prithvi_Vadaviya)\
**Post date:** [May 27, 2017, 9:05am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794/1 "2017-05-27T09:05:40Z")

</div>

Hi,

In my program, I am reading a work file and moving(MOVE BY NAME) into into a ADABAS file.  
In the work file, there is a alphanumeric field A10 that I want to move into an array field(A10/1:15) of an ADABAS. Directly it won’t be possible to move from alphanumeric to array filed. To resolve this issue, I changed the variable name in the work file, so that it will skip that filed and later I am moving it explicitly into the first occurrence of any array.  
eg.

DEFINE DATA  
LOCAL  
01 #WORK01  
02 X1 (A10)

01 ABC VIEW OF ABC  
02 X (A10/1:15)

END-DEFINE

READ WORK 01 #WORK01  
MOVE BY NAME #WORK01 to ABC  
MOVE #WORK01.X1 TO ABC.X(1)  
.  
.  
.  
.

Here, I am moving into first occurrence of an array. This ADABAS records will move to log file with move by name in the object routine, and I think there is some problem while moving alphanumeric filed into first occurrence of ( A10/1:15) and the same array field is moving into the another array filed of (A10/1:15).

Can someone please help me to resolve this problem?

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [May 28, 2017, 3:58am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794/2 "2017-05-28T03:58:01Z")

</div>

Please read the Natural reference manual and learn what MOVE BY NAME actually does.  
It would appear from what you posted that the MOVE BY NAME will not be moving anything. For something to actually get moved you would need structures such as:  
DEFINE DATA  
LOCAL  
01 #WORK01  
02 X1 (A10)

01 ABC VIEW OF ABC  
02 X1 (A10)

Natural looks for variable names that are identical in both Groups (#WORK01 and ABC, both of which are groups). It does not appear you have any matches, hence nothing will be moved.

You might read up on MOVE BY POSITION, which might meet your requirements.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [May 29, 2017, 8:25am UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794/3 "2017-05-29T08:25:38Z")

</div>

> [@](#):
>
> Directly it won’t be possible to move from alphanumeric to array filed.

I presume that you don’t want the scalar value to fill the array.

```auto
DEFINE DATA LOCAL
1 #WORK01
  2 X (A10) INIT <'scalar'>
  2 A (A1) INIT <'a'>
  2 N (N1) INIT <1>
1 ABC
  2 X (A10/1:5) INIT <'array1', 'array2'>
  2 A (A1)
  2 N (N1)
END-DEFINE
MOVE BY NAME #WORK01 TO ABC
DISPLAY #WORK01
        ABC
END

    #WORK01 ABC
 
    X A N X A N
---------- - -- ---------- - --
 
scalar a 1 scalar a 1
                scalar
                scalar
                scalar
                scalar
```

MOVE BY NAME will work if you redefine the array so that the first entry has the same name as the renamed scalar in the WORK file.

```auto
DEFINE DATA LOCAL
1 #WORK01
  2 X1 (A10) INIT <'scalar'>
  2 A (A1) INIT <'a'>
  2 N (N1) INIT <1>
1 ABC
  2 X (A10/1:5) INIT <'array1', 'array2'>
                   2 REDEFINE X
    3 X1 (A10) /* <-- scalar
  2 A (A1)
  2 N (N1)
END-DEFINE
MOVE BY NAME #WORK01 TO ABC
DISPLAY #WORK01
        ABC
END
 
    #WORK01 ABC
 
    X1 A N X A N
---------- - -- ---------- - --
 
scalar a 1 scalar a 1 
                array2
```

The results above will make more sense when viewed with a fixed font.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:38pm UTC](https://techcommunity.softwareag.com/t/is-it-possible-to-move-alphanumeric-field-to-an-array/194794/4 "2021-04-02T15:38:34Z")

</div>


