# Natural Internal Field number

**URL:** <https://techcommunity.softwareag.com/t/natural-internal-field-number/76552>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, Natural-Database-and-TP-Monitor-Interfaces-on-Mainframes\
**Created:** [April 14, 2008, 11:16pm UTC](https://techcommunity.softwareag.com/t/natural-internal-field-number/76552 "2008-04-14T23:16:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michele1](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@Michele1](https://techcommunity.softwareag.com/u/Michele1)\
**Post date:** [April 14, 2008, 11:16pm UTC](https://techcommunity.softwareag.com/t/natural-internal-field-number/76552/1 "2008-04-14T23:16:45Z")

</div>

Can I refer to a mapped field by its internal number. I know POS contains a number representing a field in which to put the cursor on.

Can I use this number to set the attributes? If so HOW?  
I tried.

#fieldx := #mark  
#fieldx-attr := (AD-I)

Of course it did not like fieldx-attr .

Any help would be appreciated

If I don’t do this, then I have to go through a series if decides, and the Mark is set in copy code used by various programs.

---

<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:** [April 19, 2008, 1:05am UTC](https://techcommunity.softwareag.com/t/natural-internal-field-number/76552/2 "2008-04-19T01:05:11Z")

</div>

This can be done, but most developers would consider the code “too tricky” for production applications.

```auto
DEFINE DATA LOCAL
1 #A (A10)
1 #B (A10)
1 #C (A10)
1 #D (A10)
1 #MARK (I4) 1 REDEFINE #MARK
  2 #MARK-B (B4)
1 #ATTRIB (4) /* Enough entries to hold all fields
  2 #POS (I4) /* Unique internal identifier
                   2 REDEFINE #POS
    3 #POS-B (B4)
  2 #CV (C) /* Dynamic attributes
1 #MSG (A25)
1 #I (I4)
END-DEFINE
*
#POS (1) := POS (#A) /* Identify each field
#POS (2) := POS (#B)
#POS (3) := POS (#C)
#POS (4) := POS (#D)
*
REPEAT
  INPUT (AD=MDLT) WITH TEXT #MSG 
                       MARK #MARK
        #A (CV=#CV(1)) /* Dynamic attributes via CV
     // #B (CV=#CV(2))
     // #C (CV=#CV(3))
     // #D (CV=#CV(4))
  RESET #CV (*)
  DECIDE FOR FIRST CONDITION /* Determine which field
    WHEN #A <> ' '
         #MARK := POS (#A)
    WHEN #B <> ' '
         #MARK := POS (#B)
    WHEN #C <> ' '
         #MARK := POS (#C)
    WHEN #D <> ' '
         #MARK := POS (#D)
    WHEN NONE
         IGNORE
  END-DECIDE
  /*
  EXAMINE #POS-B (*) FOR #MARK-B GIVING INDEX #I /* Determine which CV
  #CV (#I) := (AD=D CD=RE) /* Sample attributes
  COMPRESS NUMERIC 'First entry:'
                   #I
              INTO #MSG
END-REPEAT
END
```

---

<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, 2:49pm UTC](https://techcommunity.softwareag.com/t/natural-internal-field-number/76552/3 "2021-04-02T14:49:21Z")

</div>


