Dynamic attribute change of MAP Field from Natural Program

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

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.

1 Like

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.

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

AD=P is used to temporarily protect the field.

1 Like

Thankyou so much Wolfgang its working perfectly now.

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.

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.

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.

Hi Ralph,
Thank you so much for the information.

[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.

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

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.