I would like to know how to use the OCOD and OPEV operands with multi configuration files: In case the same operand is present more than once (for example for different configurations) how to read the right one?
Also, I want to know if it is possible to use OCOD with mathematical operands, like MINN, or MAXX, and same question, what if there is more than one in the Merit Function?
Otherwise, is there a simpler way to read one value from any line in the MF?
Best answer by David.NguyenView original
Every Merit Function operand type is identified by an integer code. And I’m not talking about the operands you actually have in your Merit Function Editor, I’m talking about every single type of Merit Function operand. You can retrieve this integer code with OCOD. If you run the following macro with the name of your operand of interest (REAY in this example):
It will return the following codes for the different operands (change REAY in the line of code above for MINN, MAXX, or any other operand you like):
Now, OPEV serves to evaluate an operand that is not in your Merit Function Editor. The Help File reads:
However, to be able to do that, OPEV needs to know what operand type it should compute. Therefore, it needs the integer code from OCOD. Because OPEV doesn’t have any knowledge of the Merit Function Editor, it cannot compute MAXX, and MINN. Again from the Help File:
If you wanted to evaluate MAXX, and MINN, you’d have to add this operand to your Merit Function Editor (either manually or using ZPL with the keywords INSERTMFO and SETOPERAND).
If you then want to read the value of an operand that is present in your Merit Function Editor, you need to use OPER. OPER has only two parameters, the operand number, and the data you want to retrieve (for an operand value it is number 10, check the Help File for other data such as Weight or % Contrib).
Imagine I have a Merit Function like so (CONS means constant, it is just a number whose Value equals the Target):
If I wanted to take the MAXX with ZPL, this is what I would write:
You could also delete the operand after its use using DELETEMFO. The code above returns the value:
I hope this helps, and take care,
Thanks, it helped a lot!