Altering an Map's edit field ZP=ON or ZP=off

Is it possible to alter ZP=on or ZP=OFF from within a map’s processing rules?

I do not want to change the programs.
I have 3 fields which are all defined by the database.

If all are zero, I want to display these 3 numeric fields as blanks.

If any of the 3 fields are zero, I want to display the zeroes.

The map field are
FIELDA N(3) - DEFINED in MAP as ZP=on
FIELDB N(2) - DEFINED in MAP as ZP=on
FIELDC N(4) - DEFINED in MAP as ZP=on

I thought a processing rule on FIELDA , B and C each, such as shown below would work:

IF & = 0 AND FIELDB = 0 AND FIELDC= 0
& ZP=OFF
ELSE
& ZP=ON
END IF

Problem how do I access the & 's parameter ZP in the map from the processing rules and change it ? What is the syntax? Is it possible?
:idea: :?:

Quick answer; it is not possible without a lot of effort.

First, processing rules are after the fact, not before a Map is displayed. There is a way to create what might be called a pre-processing rule (thanks andreas) for a map. It is rather involved, it uses a Layout to execute code before the Map is displayed. However, this can be done without changing the program. If interested, drop me an e-mail and i will send you an article on pre processing.

Back to the problem. Probably the easiest way to do this is to avoid numeric fields on the Map. You could have three fields such as fielda-alpha, fieldb-alpha and fieldc-alpha.

Before the Map is displayed you could employ your logic to decide whether you want to see blanks, a value, or a zero. Suppose a zero is required for fielda; you would MOVE ’ 0’ to fielda-alpha (or you could MOVE '0 ', depending on which you want).

If these fields are AD=M you could have a processing rule such as fielda = val (fielda-alpha). The problem with this approach is that the program will require changing.

Any other solution I can imagine (e.g. two sets of variables on the Map) would also require changing the program.

steve

Thank you Steve for answering my question on ZP = on and off allowable within a map. As it is not possible , I will probably change the programs, etc and display alpha fields. I have already done this, but I was wondering if there was an alternative way.

PLEASE SEND ME the article on pre-processing. I always love to learn new things. Thanks again. :smiley:

Here’s a discussion on a related problem: http://tech.forums.softwareag.com/viewtopic.php?t=7222

Another solution is to use a control variable. A zero suppressed field is the same as a blank field and is also the same as a non displayed field.

So you can add a control variable to the field on the map and before the input statement in the program you can add the logic wether your field should be visible or not.

This solution needs less changing in the program (before input) and needs no processing in processing rules or program (after input). No need for additional alfa fields and data conversion statements. Less changes is less possible introduction of new errors.

This is a little program wich shows this:
DEFINE DATA LOCAL
1 #P (L)
1 #N (N5)
1 #C (C)
END-DEFINE
SET KEY PF3=‘%.’
REPEAT
IF #P
#C := (AD=N)
ELSE
#C := (AD=D)
END-IF
INPUT (AD=OI) #P(AD=MULT) / #N (CV=#C)
END-REPEAT