With the MOVE EDITED statement you can apply an edit mask for
Operand1 to output a field of any format (except H/C) into an alpha string (A/U/B) with a specific
layout described by the edit mask.
The edit mask can be considered as an output edit mask, as it decorates the actual value of operand1
with further filling characters, determines the number of (int/prec) digits for numeric fields and/or
the presentation format to show a date/time field.
Operand2 to input a field of any format (except H/C) from an alpha string (A/U/B) with a specific
edit mask that describes the position of the significant input data.
The edit mask can be considered as an input edit mask, as it defines which character positions inside the
alpha string should be took into account to fill into operand2 and which positions should be disregarded.
In other words, the data used to move into operand2 is filtered out from the alpha type operand1 string
with the input edit mask.
However, one thing appears unlucky.
Although of course you have to know at which places the relevant data for operand2 resides, sometimes
it is unclear which exact other filling characters are around. The edit mask however requires the exact
specification of these additional characters, even they are disregarded at the end. If the extra filling chars
are not specified correctly, the following runtime error comes up at runtime
-> NAT1143 Input does not correspond to input edit mask.
Example:
MOVE EDITED 'X25-03-2024X' TO #D (EM=XDD-MM-YYYYX) -> works
because extra chars X are exactly referenced in EM
MOVE EDITED 'Y25-03-2024Y' TO #D (EM=XDD-MM-YYYYX) -> NAT1143
because Y / X mismatch
Proposal:
Advance runtime logic to allow a wildcard character ‘?’ that accepts every filling character.
MOVE EDITED 'XX25/03/2024Y' TO #D (EM=??DD?MM?YYYY?) -> works
MOVE EDITED '..25.03.2024X' TO #D (EM=??DD?MM?YYYY?) -> works
because ? stands for everything
The special meaning of ‘?’ applies only for an output edit mask used in MOVE EDITED, but nowhere else.
Risk:
Close to nothing, since no application operates with wanted runtime errors.
The change applies only at a place where runtime error NAT1143 has appeared before.
Chance:
The new meaning of ? in the MOVE EDITED forms a functionality to punch out any set of characters from a string,
without the danger to error NAT1143.
This feature is new and can only be substituted with a long winded COMPRESS statement
MOVE EDITED 'This Is A String’ TO #A (EM=X????X??X?X?????)
Write #A -> shows ‘TIAS’
MOVE EDITED 'Day 03 Month 05 Year 24' TO #D (EM=????DD???????MM??????YY)
Write #D -> shows ‘24-05-03’
MOVE EDITED 'Filling 12.3 percent' TO #N (EM=#????????ZZ9.9????????)
Write #N -> shows ‘ 12.3’