EVALOPT parameter: Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 6: Line 6:
<dd>0
<dd>0
<dt>Maximum value
<dt>Maximum value
<dd>7
<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 & 4 added in 79)  
<dd>V7.8 (Options 2, 4, and 8 added in V7.9)  
</dl>
</dl>


==Description==
==Description==
The user parameter <var>EVALOPT</var> allows optional modifications to evaluation behaviors. The bits in <var>EVALOPT</var> have the following meanings:
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, the evaluating request will be cancelled on truncation of a data string. </td></tr>
<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, the evaluating request will be cancelled on a non-convertable number. </td></tr>
<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, nulls will be considered as non-convertable numbers. </td></tr>
<td>If on, M204.2985 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.</td></tr>
<tr><th>X'08'</th>
<td>If on, an M204.2985 will be issued on attempt to add a <var>null</var> object to a collection (Arraylist or NamedArraylist). </td></tr>
</table>
</table>
<p>
<p>
Line 34: Line 38:
%s = %v                 
%s = %v                 
%f = %v                 
%f = %v                 
%n = ''               
%n = "           
printtext {~} = {%s}   
printtext {~} = {%s}   
printtext {~} = {%f}   
printtext {~} = {%f}   
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]]

Latest revision as of 13:40, 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:

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 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'08' If on, an M204.2985 will be issued on attempt to add a 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