EVALOPT parameter: Difference between revisions
RPuszewski (talk | contribs) No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
<dd>0 | <dd>0 | ||
<dt>Maximum value | <dt>Maximum value | ||
<dd> | <dd>15 | ||
<dt>Parameter type | <dt>Parameter type | ||
<dd>User | <dd>User | ||
Line 12: | Line 12: | ||
<dd>Any user | <dd>Any user | ||
<dt>Introduced | <dt>Introduced | ||
<dd>V7.8 (Options 2 | <dd>V7.8 (Options 2, 4, and 8 added in V7.9) | ||
</dl> | </dl> | ||
==Description== | ==Description== | ||
The user parameter <var>EVALOPT</var> | The <var>EVALOPT</var> user parameter allows one to trap conditions that might be indicative of application errors. If one of the conditions trapped by <var>EVALOPT</var> is encountered, a "M204.2985: EVALOPT trapped error" message is issued. This message can be MSGCTL'ed to cause request cancellation to ensure that application don't continue after a condition trapped by this facility is encountered. | ||
The bits in <var>EVALOPT</var> have the following meanings: | |||
<table class="thJustBold"> | <table class="thJustBold"> | ||
<tr><th>X'01'</th> | <tr><th>X'01'</th> | ||
<td>If on, | <td>If on, a M204.2985 will be issued on an assignment of a string to a variable not long enough to hold it. This condition normally results in truncation of the source string.</td></tr> | ||
<tr><th>X'02'</th> | <tr><th>X'02'</th> | ||
<td>If on, | <td>If on, a M204.2985 will be issued when automatic conversion of a string to a number encounters a string that is not a valid representation of a number. This condition normally results in a 0 being assigned to the target.</td></tr> | ||
<tr><th>X'04'</th> | <tr><th>X'04'</th> | ||
<td>If on, | <td>If on, M204.2985</td></tr> will be issued when automatic conversion of a string to a number encounters an empty (zero-length) string. This condition normally results in a 0 being assigned to the target. | ||
<tr><th>X'08'</th> | |||
<td>If on, an M204.2985 will be issued on attempt to add a <va>null</var> object to a collection (Arraylist or NamedArraylist). </td></tr> | |||
</table> | </table> | ||
<p> | <p> | ||
Line 47: | Line 51: | ||
<p class="code">M204.2985: Invalid numeric conversion </p> | <p class="code">M204.2985: Invalid numeric conversion </p> | ||
[[Category:User parameters]] | |||
[[Category:Parameters]] | [[Category:Parameters]] |
Revision as of 13:39, 4 December 2023
Evaluation options
Summary
- Default value
- 0
- Maximum value
- 15
- Parameter type
- User
- Where set
- Any user
- Introduced
- V7.8 (Options 2, 4, and 8 added in V7.9)
Description
The EVALOPT user parameter allows one to trap conditions that might be indicative of application errors. If one of the conditions trapped by EVALOPT is encountered, a "M204.2985: EVALOPT trapped error" message is issued. This message can be MSGCTL'ed to cause request cancellation to ensure that application don't continue after a condition trapped by this facility is encountered.
The bits in EVALOPT have the following meanings:
will be issued when automatic conversion of a string to a number encounters an empty (zero-length) string. This condition normally results in a 0 being assigned to the target.X'01' | If on, a M204.2985 will be issued on an assignment of a string to a variable not long enough to hold it. This condition normally results in truncation of the source string. |
---|---|
X'02' | If on, a M204.2985 will be issued when automatic conversion of a string to a number encounters a string that is not a valid representation of a number. This condition normally results in a 0 being assigned to the target. |
X'04' | If on, M204.2985 |
X'08' | If on, an M204.2985 will be issued on attempt to add a <va>null object to a collection (Arraylist or NamedArraylist). |
For example, consider the following code:
%v is string len 2 initial('ST') %s is string len 1 %f is float %n is float %s = %v %f = %v %n = " printtext {~} = {%s} printtext {~} = {%f} printtext {~} = {%n}
If EVALOPT is set to 0 (default), then the above code would allow silent truncation and give the result:
%s = S %f = 0 %n = 0
If EVALOPT is set to 1 , then the above code is cancelled with the following message:
M204.0552: Variable too small for result
If EVALOPT is set to 2 or 4 , then the above code is cancelled with the following message:
M204.2985: Invalid numeric conversion