# Dynamic attribute change of MAP Field from Natural Program

**URL:** <https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, Natural-on-Windows-Unix\
**Created:** [February 20, 2012, 11:58am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739 "2012-02-20T11:58:40Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shashank\_Gite1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/shashank_gite1/32/351_2.png) [@Shashank\_Gite1](https://techcommunity.softwareag.com/u/Shashank_Gite1)\
**Post date:** [February 20, 2012, 11:58am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/1 "2012-02-20T11:58:40Z")

</div>

Hi,

I want to change the MAP attributes of some occurances of an array field from Natural Program as below.

1 #FIELD (A80/1:12)

I am moving values in each occurance of #FIELD(1) to #FIELD(12) form an Adabas file. If any of the occurance contains space I want to change the attribute of that perticular occurance from AD=MD’\_’ to AD=OD.

Please suggest how can I do this thru the program itself.

Thanks  
Shashank

---

<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:** [February 20, 2012, 12:08pm UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/2 "2012-02-20T12:08:35Z")

</div>

Use a Control Variable.

On the extended editing screen for a map (.e on the field) specify a  
CV= which is an array itself, e.g. #CV(\*)

When you then LIST the map you will see the corresponding occurrences  
of #CV have been generated, i.e. #CV(1) for #FIELD(1) etc., whereas  
when you specify a non-array CV (e.g. #CV) #FIELD(1), #FIELD2 … #FIELD(12)  
will all have the same #CV assigned to it.

---

<div class="post-metadata">

**Author:** ![Shashank\_Gite1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/shashank_gite1/32/351_2.png) [@Shashank\_Gite1](https://techcommunity.softwareag.com/u/Shashank_Gite1)\
**Post date:** [February 20, 2012, 1:59pm UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/3 "2012-02-20T13:59:07Z")

</div>

Thanks Wolfgang. It worked with AD=N option for CV variable I defined.

But I wanted to make it AD=OD from AD=MD’\_'. Using AD=N the field is hidden but still it is modifiable hence data can be entered for that field. I am tring to change the attribute from Modifiable to Output attribute.

---

<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:** [February 20, 2012, 2:59pm UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/4 "2012-02-20T14:59:36Z")

</div>

Please use (AD=P) instead of (AD=O).

AD=P is used to temporarily protect the field.

---

<div class="post-metadata">

**Author:** ![Shashank\_Gite1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/shashank_gite1/32/351_2.png) [@Shashank\_Gite1](https://techcommunity.softwareag.com/u/Shashank_Gite1)\
**Post date:** [February 21, 2012, 9:12am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/5 "2012-02-21T09:12:06Z")

</div>

Thankyou so much Wolfgang its working perfectly now.

---

<div class="post-metadata">

**Author:** ![krishna\_prasad2](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@krishna\_prasad2](https://techcommunity.softwareag.com/u/krishna_prasad2)\
**Post date:** [March 16, 2016, 4:18am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/6 "2016-03-16T04:18:15Z")

</div>

Hi,  
I see there is attribute defined on the map for each field called ‘DY=\_\_\_\_\_\_\_\_\_\_\_\_’. Can some one please explain me what this attribute is and why do we need this attribute?  
How do we use this attribute to change the properties of a field from program.

Thank You in advance.

---

<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:** [March 16, 2016, 9:02am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/7 "2016-03-16T09:02:01Z")

</div>

The optional DY parameter is used to affect the characteristics (intensity, italics, underscore, reverse video, color, etc) of a portion of a field.

This is documented in the Parameter Reference. I found a handful of examples in the SYSEXT library in my Natural for Windows version. They are probably available on the mainframe, too.

---

<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:** [March 17, 2016, 7:55am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/8 "2016-03-17T07:55:41Z")

</div>

Please note that using DY to set characteristics for parts of a field means these fields will be “split” as a 3270 control characters needs to be inserted at the physical screen location where attributes change so the “field” will no longer be a single entity but split into a number of fields (depending on the DY attributes) one needs to tab to/over.

---

<div class="post-metadata">

**Author:** ![krishna\_prasad2](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@krishna\_prasad2](https://techcommunity.softwareag.com/u/krishna_prasad2)\
**Post date:** [March 18, 2016, 5:04am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/9 "2016-03-18T05:04:25Z")

</div>

> [@Ralph Zbrog](#):
>
> The optional DY parameter is used to affect the characteristics (intensity, italics, underscore, reverse video, color, etc) of a portion of a field.
> 
> This is documented in the Parameter Reference. I found a handful of examples in the SYSEXT library in my Natural for Windows version. They are probably available on the mainframe, too.

Hi Ralph,  
Thank you so much for the information.

---

<div class="post-metadata">

**Author:** ![krishna\_prasad2](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@krishna\_prasad2](https://techcommunity.softwareag.com/u/krishna_prasad2)\
**Post date:** [March 18, 2016, 5:10am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/10 "2016-03-18T05:10:13Z")

</div>

[quote=Wolfgang Winter]  
Please note that using DY to set characteristics for parts of a field means these fields will be “split” as a 3270 control characters needs to be inserted at the physical screen location where attributes change so the “field” will no longer be a single entity but split into a number of fields (depending on the DY attributes) one needs to tab to/over.[/quo

Hi Wolfgang  
Than you for the reply.

Do you mean the filed that has a definition of DY attribute split into a more than one field with each part a different field name? How can we refer these fields in the program to pass on some values to them?

Thank You in advance.

---

<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:** [March 18, 2016, 8:15am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/11 "2016-03-18T08:15:20Z")

</div>

Wolfgang is warning you that each of the embedded delimiters will appear as a space, so the field will appear as multiple values on a mainframe display.

For example if delimiters ! and $ are defined as “red” and “blue”, respectively, you could display “Ralph” in alternating colors. !R$a!l$p!h will be seen as R a l p h

On a mainframe terminal it is not possible to display this as Ralph

---

<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:** [March 18, 2016, 1:00pm UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/12 "2016-03-18T13:00:32Z")

</div>

> [@](#):
>
> Do you mean the filed that has a definition of DY attribute split into a more than one field with each part a different field name? How can we refer these fields in the program to pass on some values to them?

No, there not additional fields created (in the sense of a REDEFINE). You can not reference the DY partitions of a field by some different field name.

To build on Ralph’s example. Suppose I have a single alpha field, say #PLACE, which has a city name, followed by a comma, followed by country name.

Here is a brief program

define data local  
1 #place (a30) init \<‘paris,france’\>  
end-define  
\*  
write #place (cd=bl dy=,re$)  
end

The output would be: paris france

Note the space between paris and france. If you were to simply WRITE #place you would see paris,france.

Also, please note you cannot reference paris, or france, individually. There is no #city or #country.

Yes, you could use a SEPARATE to create such subfields, however DY= cannot create such subfields.

Basically, DY= consists of “pairs” which are {a start attribute change character (a comma in my example above)} followed by {attribute changes (RE in the example above)}. There must also be a “terminating character”, $ in the example above). You may have many “pairs” in a single DY specification, as noted by Ralph.

---

<div class="post-metadata">

**Author:** ![krishna\_prasad2](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@krishna\_prasad2](https://techcommunity.softwareag.com/u/krishna_prasad2)\
**Post date:** [March 19, 2016, 4:51am UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/13 "2016-03-19T04:51:50Z")

</div>

> [@Steve Robinson](#):
>
> > [@](#):
> >
> > Do you mean the filed that has a definition of DY attribute split into a more than one field with each part a different field name? How can we refer these fields in the program to pass on some values to them?
> 
> No, there not additional fields created (in the sense of a REDEFINE). You can not reference the DY partitions of a field by some different field name.
> 
> To build on Ralph’s example. Suppose I have a single alpha field, say #PLACE, which has a city name, followed by a comma, followed by country name.
> 
> Here is a brief program
> 
> define data local  
> 1 #place (a30) init \<‘paris,france’\>  
> end-define  
> \*  
> write #place (cd=bl dy=,re$)  
> end
> 
> The output would be: paris france
> 
> Note the space between paris and france. If you were to simply WRITE #place you would see paris,france.
> 
> Also, please note you cannot reference paris, or france, individually. There is no #city or #country.
> 
> Yes, you could use a SEPARATE to create such subfields, however DY= cannot create such subfields.
> 
> Basically, DY= consists of “pairs” which are {a start attribute change character (a comma in my example above)} followed by {attribute changes (RE in the example above)}. There must also be a “terminating character”, $ in the example above). You may have many “pairs” in a single DY specification, as noted by Ralph.

Hi Steve,

Thank you very much. Your help is very much appreciated.

---

<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:01pm UTC](https://techcommunity.softwareag.com/t/dynamic-attribute-change-of-map-field-from-natural-program/99739/14 "2021-04-02T15:01:34Z")

</div>


